<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-}</span><span>
</span><span id="line-5"></span><span>
</span><span id="line-6"></span><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-7"></span><span>
</span><span id="line-8"></span><span class="hs-pragma">{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}</span><span>
</span><span id="line-9"></span><span>
</span><span id="line-10"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Tc.TyCl.Build</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-11"></span><span>        </span><span class="annot"><a href="GHC.Tc.TyCl.Build.html#buildDataCon"><span class="hs-identifier">buildDataCon</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-12"></span><span>        </span><span class="annot"><a href="GHC.Tc.TyCl.Build.html#buildPatSyn"><span class="hs-identifier">buildPatSyn</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-13"></span><span>        </span><span class="annot"><a href="GHC.Tc.TyCl.Build.html#TcMethInfo"><span class="hs-identifier">TcMethInfo</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.TyCl.Build.html#MethInfo"><span class="hs-identifier">MethInfo</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.TyCl.Build.html#buildClass"><span class="hs-identifier">buildClass</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-14"></span><span>        </span><span class="annot"><a href="GHC.Tc.TyCl.Build.html#mkNewTyConRhs"><span class="hs-identifier">mkNewTyConRhs</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-15"></span><span>        </span><span class="annot"><a href="GHC.Tc.TyCl.Build.html#newImplicitBinder"><span class="hs-identifier">newImplicitBinder</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.TyCl.Build.html#newTyConRepName"><span class="hs-identifier">newTyConRepName</span></a></span><span>
</span><span id="line-16"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-20"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-21"></span><span>
</span><span id="line-22"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Iface.Env.html"><span class="hs-identifier">GHC.Iface.Env</span></a></span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html"><span class="hs-identifier">GHC.Core.FamInstEnv</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInstEnvs"><span class="hs-identifier">FamInstEnvs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#mkNewTypeCoAxiom"><span class="hs-identifier">mkNewTypeCoAxiom</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html"><span class="hs-identifier">GHC.Builtin.Types</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html#isCTupleTyConName"><span class="hs-identifier">isCTupleTyConName</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.Prim.html"><span class="hs-identifier">GHC.Builtin.Types.Prim</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.Prim.html#voidPrimTy"><span class="hs-identifier">voidPrimTy</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html"><span class="hs-identifier">GHC.Core.DataCon</span></a></span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.PatSyn.html"><span class="hs-identifier">GHC.Core.PatSyn</span></a></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.html"><span class="hs-identifier">GHC.Types.Var</span></a></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html"><span class="hs-identifier">GHC.Types.Var.Set</span></a></span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.html"><span class="hs-identifier">GHC.Types.Name</span></a></span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Env.html"><span class="hs-identifier">GHC.Types.Name.Env</span></a></span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.Make.html"><span class="hs-identifier">GHC.Types.Id.Make</span></a></span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Class.html"><span class="hs-identifier">GHC.Core.Class</span></a></span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html"><span class="hs-identifier">GHC.Core.TyCon</span></a></span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Type.html"><span class="hs-identifier">GHC.Core.Type</span></a></span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.html"><span class="hs-identifier">GHC.Types.Id</span></a></span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html"><span class="hs-identifier">GHC.Tc.Utils.TcType</span></a></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Multiplicity.html"><span class="hs-identifier">GHC.Core.Multiplicity</span></a></span><span>
</span><span id="line-40"></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html"><span class="hs-identifier">GHC.Types.SrcLoc</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier">SrcSpan</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#noSrcSpan"><span class="hs-identifier">noSrcSpan</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Monad.html"><span class="hs-identifier">GHC.Tc.Utils.Monad</span></a></span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Supply.html"><span class="hs-identifier">GHC.Types.Unique.Supply</span></a></span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-47"></span><span>
</span><span id="line-48"></span><span>
</span><span id="line-49"></span><span id="local-6989586621681088618"><span id="local-6989586621681088619"><span class="annot"><a href="GHC.Tc.TyCl.Build.html#mkNewTyConRhs"><span class="hs-identifier hs-type">mkNewTyConRhs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRnIf"><span class="hs-identifier hs-type">TcRnIf</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681088619"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681088618"><span class="hs-identifier hs-type">n</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#AlgTyConRhs"><span class="hs-identifier hs-type">AlgTyConRhs</span></a></span></span></span><span>
</span><span id="line-50"></span><span class="hs-comment">-- ^ Monadic because it makes a Name for the coercion TyCon</span><span>
</span><span id="line-51"></span><span class="hs-comment">--   We pass the Name of the parent TyCon, as well as the TyCon itself,</span><span>
</span><span id="line-52"></span><span class="hs-comment">--   because the latter is part of a knot, whereas the former is not.</span><span>
</span><span id="line-53"></span><span id="mkNewTyConRhs"><span class="annot"><span class="annottext">mkNewTyConRhs :: forall m n. Name -&gt; TyCon -&gt; DataCon -&gt; TcRnIf m n AlgTyConRhs
</span><a href="GHC.Tc.TyCl.Build.html#mkNewTyConRhs"><span class="hs-identifier hs-var hs-var">mkNewTyConRhs</span></a></span></span><span> </span><span id="local-6989586621681088436"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088436"><span class="hs-identifier hs-var">tycon_name</span></a></span></span><span> </span><span id="local-6989586621681088435"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681088435"><span class="hs-identifier hs-var">tycon</span></a></span></span><span> </span><span id="local-6989586621681088434"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681088434"><span class="hs-identifier hs-var">con</span></a></span></span><span>
</span><span id="line-54"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681088433"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088433"><span class="hs-identifier hs-var">co_tycon_name</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; (OccName -&gt; OccName) -&gt; TcRnIf m n Name
forall m n. Name -&gt; (OccName -&gt; OccName) -&gt; TcRnIf m n Name
</span><a href="GHC.Tc.TyCl.Build.html#newImplicitBinder"><span class="hs-identifier hs-var">newImplicitBinder</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088436"><span class="hs-identifier hs-var">tycon_name</span></a></span><span> </span><span class="annot"><span class="annottext">OccName -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#mkNewTyCoOcc"><span class="hs-identifier hs-var">mkNewTyCoOcc</span></a></span><span>
</span><span id="line-55"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681088431"><span class="annot"><span class="annottext">nt_ax :: CoAxiom Unbranched
</span><a href="#local-6989586621681088431"><span class="hs-identifier hs-var hs-var">nt_ax</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TyCon -&gt; [TyVar] -&gt; [Role] -&gt; Type -&gt; CoAxiom Unbranched
</span><a href="GHC.Core.FamInstEnv.html#mkNewTypeCoAxiom"><span class="hs-identifier hs-var">mkNewTypeCoAxiom</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088433"><span class="hs-identifier hs-var">co_tycon_name</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681088435"><span class="hs-identifier hs-var">tycon</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088430"><span class="hs-identifier hs-var">etad_tvs</span></a></span><span> </span><span class="annot"><span class="annottext">[Role]
</span><a href="#local-6989586621681088429"><span class="hs-identifier hs-var">etad_roles</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088428"><span class="hs-identifier hs-var">etad_rhs</span></a></span><span>
</span><span id="line-56"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; TcRnIf m n ()
forall m n. SDoc -&gt; TcRnIf m n ()
</span><a href="GHC.Tc.Utils.Monad.html#traceIf"><span class="hs-identifier hs-var">traceIf</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;mkNewTyConRhs&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxiom Unbranched -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxiom Unbranched
</span><a href="#local-6989586621681088431"><span class="hs-identifier hs-var">nt_ax</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-57"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">AlgTyConRhs -&gt; TcRnIf m n AlgTyConRhs
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">NewTyCon :: DataCon
-&gt; Type
-&gt; ([TyVar], Type)
-&gt; CoAxiom Unbranched
-&gt; Bool
-&gt; AlgTyConRhs
</span><a href="GHC.Core.TyCon.html#NewTyCon"><span class="hs-identifier hs-type">NewTyCon</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">data_con :: DataCon
</span><a href="GHC.Core.TyCon.html#data_con"><span class="hs-identifier hs-var">data_con</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681088434"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-58"></span><span>                             </span><span class="annot"><span class="annottext">nt_rhs :: Type
</span><a href="GHC.Core.TyCon.html#nt_rhs"><span class="hs-identifier hs-var">nt_rhs</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088420"><span class="hs-identifier hs-var">rhs_ty</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-59"></span><span>                             </span><span class="annot"><span class="annottext">nt_etad_rhs :: ([TyVar], Type)
</span><a href="GHC.Core.TyCon.html#nt_etad_rhs"><span class="hs-identifier hs-var">nt_etad_rhs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088430"><span class="hs-identifier hs-var">etad_tvs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088428"><span class="hs-identifier hs-var">etad_rhs</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-60"></span><span>                             </span><span class="annot"><span class="annottext">nt_co :: CoAxiom Unbranched
</span><a href="GHC.Core.TyCon.html#nt_co"><span class="hs-identifier hs-var">nt_co</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoAxiom Unbranched
</span><a href="#local-6989586621681088431"><span class="hs-identifier hs-var">nt_ax</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-61"></span><span>                             </span><span class="annot"><span class="annottext">nt_lev_poly :: Bool
</span><a href="GHC.Core.TyCon.html#nt_lev_poly"><span class="hs-identifier hs-var">nt_lev_poly</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Core.Type.html#isKindLevPoly"><span class="hs-identifier hs-var">isKindLevPoly</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088415"><span class="hs-identifier hs-var">res_kind</span></a></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-62"></span><span>                             </span><span class="hs-comment">-- Coreview looks through newtypes with a Nothing</span><span>
</span><span id="line-63"></span><span>                             </span><span class="hs-comment">-- for nt_co, or uses explicit coercions otherwise</span><span>
</span><span id="line-64"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-65"></span><span>    </span><span id="local-6989586621681088414"><span class="annot"><span class="annottext">tvs :: [TyVar]
</span><a href="#local-6989586621681088414"><span class="hs-identifier hs-var hs-var">tvs</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [TyVar]
</span><a href="GHC.Core.TyCon.html#tyConTyVars"><span class="hs-identifier hs-var hs-var">tyConTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681088435"><span class="hs-identifier hs-var">tycon</span></a></span><span>
</span><span id="line-66"></span><span>    </span><span id="local-6989586621681088412"><span class="annot"><span class="annottext">roles :: [Role]
</span><a href="#local-6989586621681088412"><span class="hs-identifier hs-var hs-var">roles</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Role]
</span><a href="GHC.Core.TyCon.html#tyConRoles"><span class="hs-identifier hs-var">tyConRoles</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681088435"><span class="hs-identifier hs-var">tycon</span></a></span><span>
</span><span id="line-67"></span><span>    </span><span id="local-6989586621681088415"><span class="annot"><span class="annottext">res_kind :: Type
</span><a href="#local-6989586621681088415"><span class="hs-identifier hs-var hs-var">res_kind</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Type
</span><a href="GHC.Core.TyCon.html#tyConResKind"><span class="hs-identifier hs-var hs-var">tyConResKind</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681088435"><span class="hs-identifier hs-var">tycon</span></a></span><span>
</span><span id="line-68"></span><span>    </span><span id="local-6989586621681088402"><span class="annot"><span class="annottext">con_arg_ty :: Type
</span><a href="#local-6989586621681088402"><span class="hs-identifier hs-var hs-var">con_arg_ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; [Scaled Type]
</span><a href="GHC.Core.DataCon.html#dataConRepArgTys"><span class="hs-identifier hs-var">dataConRepArgTys</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681088434"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-69"></span><span>                   </span><span class="hs-special">[</span><span id="local-6989586621681088400"><span class="annot"><span class="annottext">Scaled Type
</span><a href="#local-6989586621681088400"><span class="hs-identifier hs-var">arg_ty</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Scaled Type -&gt; Type
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled Type
</span><a href="#local-6989586621681088400"><span class="hs-identifier hs-var">arg_ty</span></a></span><span>
</span><span id="line-70"></span><span>                   </span><span id="local-6989586621681088398"><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621681088398"><span class="hs-identifier hs-var">tys</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; Type
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;mkNewTyConRhs&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681088434"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled Type] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621681088398"><span class="hs-identifier hs-var">tys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-71"></span><span>    </span><span id="local-6989586621681088420"><span class="annot"><span class="annottext">rhs_ty :: Type
</span><a href="#local-6989586621681088420"><span class="hs-identifier hs-var hs-var">rhs_ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; [TyVar] -&gt; ThetaType -&gt; Type -&gt; Type
[TyVar] -&gt; ThetaType -&gt; Type -&gt; Type
</span><a href="GHC.Core.TyCo.Subst.html#substTyWith"><span class="hs-identifier hs-var">substTyWith</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; [TyVar]
</span><a href="GHC.Core.DataCon.html#dataConUnivTyVars"><span class="hs-identifier hs-var">dataConUnivTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681088434"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-72"></span><span>                         </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TyVar] -&gt; ThetaType
</span><a href="GHC.Core.TyCo.Rep.html#mkTyVarTys"><span class="hs-identifier hs-var">mkTyVarTys</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088414"><span class="hs-identifier hs-var">tvs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088402"><span class="hs-identifier hs-var">con_arg_ty</span></a></span><span>
</span><span id="line-73"></span><span>        </span><span class="hs-comment">-- Instantiate the newtype's RHS with the</span><span>
</span><span id="line-74"></span><span>        </span><span class="hs-comment">-- type variables from the tycon</span><span>
</span><span id="line-75"></span><span>        </span><span class="hs-comment">-- NB: a newtype DataCon has a type that must look like</span><span>
</span><span id="line-76"></span><span>        </span><span class="hs-comment">--        forall tvs.  &lt;arg-ty&gt; -&gt; T tvs</span><span>
</span><span id="line-77"></span><span>        </span><span class="hs-comment">-- Note that we *can't* use dataConInstOrigArgTys here because</span><span>
</span><span id="line-78"></span><span>        </span><span class="hs-comment">-- the newtype arising from   class Foo a =&gt; Bar a where {}</span><span>
</span><span id="line-79"></span><span>        </span><span class="hs-comment">-- has a single argument (Foo a) that is a *type class*, so</span><span>
</span><span id="line-80"></span><span>        </span><span class="hs-comment">-- dataConInstOrigArgTys returns [].</span><span>
</span><span id="line-81"></span><span>
</span><span id="line-82"></span><span>    </span><span class="annot"><a href="#local-6989586621681088430"><span class="hs-identifier hs-type">etad_tvs</span></a></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">]</span><span>  </span><span class="hs-comment">-- Matched lazily, so that mkNewTypeCo can</span><span>
</span><span id="line-83"></span><span>    </span><span class="annot"><a href="#local-6989586621681088429"><span class="hs-identifier hs-type">etad_roles</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#Role"><span class="hs-identifier hs-type">Role</span></a></span><span class="hs-special">]</span><span>   </span><span class="hs-comment">-- return a TyCon without pulling on rhs_ty</span><span>
</span><span id="line-84"></span><span>    </span><span class="annot"><a href="#local-6989586621681088428"><span class="hs-identifier hs-type">etad_rhs</span></a></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>     </span><span class="hs-comment">-- See Note [Tricky iface loop] in GHC.Iface.Load</span><span>
</span><span id="line-85"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681088430"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088430"><span class="hs-identifier hs-var">etad_tvs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681088429"><span class="annot"><span class="annottext">[Role]
</span><a href="#local-6989586621681088429"><span class="hs-identifier hs-var">etad_roles</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681088428"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088428"><span class="hs-identifier hs-var">etad_rhs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; [Role] -&gt; Type -&gt; ([TyVar], [Role], Type)
</span><a href="#local-6989586621681088391"><span class="hs-identifier hs-var">eta_reduce</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TyVar] -&gt; [TyVar]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088414"><span class="hs-identifier hs-var">tvs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Role] -&gt; [Role]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[Role]
</span><a href="#local-6989586621681088412"><span class="hs-identifier hs-var">roles</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088420"><span class="hs-identifier hs-var">rhs_ty</span></a></span><span>
</span><span id="line-86"></span><span>
</span><span id="line-87"></span><span>    </span><span class="annot"><a href="#local-6989586621681088391"><span class="hs-identifier hs-type">eta_reduce</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">]</span><span>       </span><span class="hs-comment">-- Reversed</span><span>
</span><span id="line-88"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#Role"><span class="hs-identifier hs-type">Role</span></a></span><span class="hs-special">]</span><span>        </span><span class="hs-comment">-- also reversed</span><span>
</span><span id="line-89"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>          </span><span class="hs-comment">-- Rhs type</span><span>
</span><span id="line-90"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#Role"><span class="hs-identifier hs-type">Role</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-comment">-- Eta-reduced version</span><span>
</span><span id="line-91"></span><span>                                           </span><span class="hs-comment">-- (tyvars in normal order)</span><span>
</span><span id="line-92"></span><span>    </span><span id="local-6989586621681088391"><span class="annot"><span class="annottext">eta_reduce :: [TyVar] -&gt; [Role] -&gt; Type -&gt; ([TyVar], [Role], Type)
</span><a href="#local-6989586621681088391"><span class="hs-identifier hs-var hs-var">eta_reduce</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681088389"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681088389"><span class="hs-identifier hs-var">a</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681088388"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088388"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Role
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681088387"><span class="annot"><span class="annottext">[Role]
</span><a href="#local-6989586621681088387"><span class="hs-identifier hs-var">rs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681088386"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088386"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681088385"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088385"><span class="hs-identifier hs-var">fun</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681088384"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088384"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Type, Type)
</span><a href="GHC.Core.Type.html#splitAppTy_maybe"><span class="hs-identifier hs-var">splitAppTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088386"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-93"></span><span>                                  </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681088382"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681088382"><span class="hs-identifier hs-var">tv</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe TyVar
</span><a href="GHC.Core.Type.html#getTyVar_maybe"><span class="hs-identifier hs-var">getTyVar_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088384"><span class="hs-identifier hs-var">arg</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-94"></span><span>                                  </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681088382"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; TyVar -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681088389"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-95"></span><span>                                  </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681088389"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; VarSet -&gt; Bool
</span><a href="GHC.Types.Var.Set.html#elemVarSet"><span class="hs-operator hs-var">`elemVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; VarSet
</span><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfType"><span class="hs-identifier hs-var">tyCoVarsOfType</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088385"><span class="hs-identifier hs-var">fun</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-96"></span><span>                                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; [Role] -&gt; Type -&gt; ([TyVar], [Role], Type)
</span><a href="#local-6989586621681088391"><span class="hs-identifier hs-var">eta_reduce</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088388"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="annot"><span class="annottext">[Role]
</span><a href="#local-6989586621681088387"><span class="hs-identifier hs-var">rs</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088385"><span class="hs-identifier hs-var">fun</span></a></span><span>
</span><span id="line-97"></span><span>    </span><span class="annot"><a href="#local-6989586621681088391"><span class="hs-identifier hs-var">eta_reduce</span></a></span><span> </span><span id="local-6989586621681088377"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088377"><span class="hs-identifier hs-var">tvs</span></a></span></span><span> </span><span id="local-6989586621681088376"><span class="annot"><span class="annottext">[Role]
</span><a href="#local-6989586621681088376"><span class="hs-identifier hs-var">rs</span></a></span></span><span> </span><span id="local-6989586621681088375"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088375"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TyVar] -&gt; [TyVar]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088377"><span class="hs-identifier hs-var">tvs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Role] -&gt; [Role]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[Role]
</span><a href="#local-6989586621681088376"><span class="hs-identifier hs-var">rs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088375"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-98"></span><span>
</span><span id="line-99"></span><span class="hs-comment">------------------------------------------------------</span><span>
</span><span id="line-100"></span><span id="local-6989586621681088583"><span id="local-6989586621681088584"><span class="annot"><a href="GHC.Tc.TyCl.Build.html#buildDataCon"><span class="hs-identifier hs-type">buildDataCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInstEnvs"><span class="hs-identifier hs-type">FamInstEnvs</span></a></span><span>
</span><span id="line-101"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span>
</span><span id="line-102"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>                     </span><span class="hs-comment">-- Declared infix</span><span>
</span><span id="line-103"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyConRepName"><span class="hs-identifier hs-type">TyConRepName</span></a></span><span>
</span><span id="line-104"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.DataCon.html#HsSrcBang"><span class="hs-identifier hs-type">HsSrcBang</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-105"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.DataCon.html#HsImplBang"><span class="hs-identifier hs-type">HsImplBang</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-106"></span><span>                </span><span class="hs-comment">-- See Note [Bangs on imported data constructors] in GHC.Types.Id.Make</span><span>
</span><span id="line-107"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabel"><span class="hs-identifier hs-type">FieldLabel</span></a></span><span class="hs-special">]</span><span>             </span><span class="hs-comment">-- Field labels</span><span>
</span><span id="line-108"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">]</span><span>                  </span><span class="hs-comment">-- Universals</span><span>
</span><span id="line-109"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyCoVar"><span class="hs-identifier hs-type">TyCoVar</span></a></span><span class="hs-special">]</span><span>                </span><span class="hs-comment">-- Existentials</span><span>
</span><span id="line-110"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#InvisTVBinder"><span class="hs-identifier hs-type">InvisTVBinder</span></a></span><span class="hs-special">]</span><span>          </span><span class="hs-comment">-- User-written 'TyVarBinder's</span><span>
</span><span id="line-111"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.DataCon.html#EqSpec"><span class="hs-identifier hs-type">EqSpec</span></a></span><span class="hs-special">]</span><span>                 </span><span class="hs-comment">-- Equality spec</span><span>
</span><span id="line-112"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#KnotTied"><span class="hs-identifier hs-type">KnotTied</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ThetaType"><span class="hs-identifier hs-type">ThetaType</span></a></span><span>       </span><span class="hs-comment">-- Does not include the &quot;stupid theta&quot;</span><span>
</span><span id="line-113"></span><span>                                       </span><span class="hs-comment">-- or the GADT equalities</span><span>
</span><span id="line-114"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#KnotTied"><span class="hs-identifier hs-type">KnotTied</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- Arguments</span><span>
</span><span id="line-115"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#KnotTied"><span class="hs-identifier hs-type">KnotTied</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>            </span><span class="hs-comment">-- Result types</span><span>
</span><span id="line-116"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#KnotTied"><span class="hs-identifier hs-type">KnotTied</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span>           </span><span class="hs-comment">-- Rep tycon</span><span>
</span><span id="line-117"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Env.html#NameEnv"><span class="hs-identifier hs-type">NameEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#ConTag"><span class="hs-identifier hs-type">ConTag</span></a></span><span>           </span><span class="hs-comment">-- Maps the Name of each DataCon to its</span><span>
</span><span id="line-118"></span><span>                                       </span><span class="hs-comment">-- ConTag</span><span>
</span><span id="line-119"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRnIf"><span class="hs-identifier hs-type">TcRnIf</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681088584"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681088583"><span class="hs-identifier hs-type">n</span></a></span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span></span></span><span>
</span><span id="line-120"></span><span class="hs-comment">-- A wrapper for DataCon.mkDataCon that</span><span>
</span><span id="line-121"></span><span class="hs-comment">--   a) makes the worker Id</span><span>
</span><span id="line-122"></span><span class="hs-comment">--   b) makes the wrapper Id if necessary, including</span><span>
</span><span id="line-123"></span><span class="hs-comment">--      allocating its unique (hence monadic)</span><span>
</span><span id="line-124"></span><span id="buildDataCon"><span class="annot"><span class="annottext">buildDataCon :: forall m n.
FamInstEnvs
-&gt; Name
-&gt; Bool
-&gt; Name
-&gt; [HsSrcBang]
-&gt; Maybe [HsImplBang]
-&gt; [FieldLabel]
-&gt; [TyVar]
-&gt; [TyVar]
-&gt; [InvisTVBinder]
-&gt; [EqSpec]
-&gt; ThetaType
-&gt; [Scaled Type]
-&gt; Type
-&gt; TyCon
-&gt; NameEnv ConTag
-&gt; TcRnIf m n DataCon
</span><a href="GHC.Tc.TyCl.Build.html#buildDataCon"><span class="hs-identifier hs-var hs-var">buildDataCon</span></a></span></span><span> </span><span id="local-6989586621681088358"><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681088358"><span class="hs-identifier hs-var">fam_envs</span></a></span></span><span> </span><span id="local-6989586621681088357"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088357"><span class="hs-identifier hs-var">src_name</span></a></span></span><span> </span><span id="local-6989586621681088356"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681088356"><span class="hs-identifier hs-var">declared_infix</span></a></span></span><span> </span><span id="local-6989586621681088355"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088355"><span class="hs-identifier hs-var">prom_info</span></a></span></span><span> </span><span id="local-6989586621681088354"><span class="annot"><span class="annottext">[HsSrcBang]
</span><a href="#local-6989586621681088354"><span class="hs-identifier hs-var">src_bangs</span></a></span></span><span> </span><span id="local-6989586621681088353"><span class="annot"><span class="annottext">Maybe [HsImplBang]
</span><a href="#local-6989586621681088353"><span class="hs-identifier hs-var">impl_bangs</span></a></span></span><span>
</span><span id="line-125"></span><span>             </span><span id="local-6989586621681088352"><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681088352"><span class="hs-identifier hs-var">field_lbls</span></a></span></span><span> </span><span id="local-6989586621681088351"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088351"><span class="hs-identifier hs-var">univ_tvs</span></a></span></span><span> </span><span id="local-6989586621681088350"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088350"><span class="hs-identifier hs-var">ex_tvs</span></a></span></span><span> </span><span id="local-6989586621681088349"><span class="annot"><span class="annottext">[InvisTVBinder]
</span><a href="#local-6989586621681088349"><span class="hs-identifier hs-var">user_tvbs</span></a></span></span><span> </span><span id="local-6989586621681088348"><span class="annot"><span class="annottext">[EqSpec]
</span><a href="#local-6989586621681088348"><span class="hs-identifier hs-var">eq_spec</span></a></span></span><span> </span><span id="local-6989586621681088347"><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088347"><span class="hs-identifier hs-var">ctxt</span></a></span></span><span> </span><span id="local-6989586621681088346"><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621681088346"><span class="hs-identifier hs-var">arg_tys</span></a></span></span><span> </span><span id="local-6989586621681088345"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088345"><span class="hs-identifier hs-var">res_ty</span></a></span></span><span>
</span><span id="line-126"></span><span>             </span><span id="local-6989586621681088344"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681088344"><span class="hs-identifier hs-var">rep_tycon</span></a></span></span><span> </span><span id="local-6989586621681088343"><span class="annot"><span class="annottext">NameEnv ConTag
</span><a href="#local-6989586621681088343"><span class="hs-identifier hs-var">tag_map</span></a></span></span><span>
</span><span id="line-127"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681088342"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088342"><span class="hs-identifier hs-var">wrap_name</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; (OccName -&gt; OccName) -&gt; TcRnIf m n Name
forall m n. Name -&gt; (OccName -&gt; OccName) -&gt; TcRnIf m n Name
</span><a href="GHC.Tc.TyCl.Build.html#newImplicitBinder"><span class="hs-identifier hs-var">newImplicitBinder</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088357"><span class="hs-identifier hs-var">src_name</span></a></span><span> </span><span class="annot"><span class="annottext">OccName -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#mkDataConWrapperOcc"><span class="hs-identifier hs-var">mkDataConWrapperOcc</span></a></span><span>
</span><span id="line-128"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681088340"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088340"><span class="hs-identifier hs-var">work_name</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; (OccName -&gt; OccName) -&gt; TcRnIf m n Name
forall m n. Name -&gt; (OccName -&gt; OccName) -&gt; TcRnIf m n Name
</span><a href="GHC.Tc.TyCl.Build.html#newImplicitBinder"><span class="hs-identifier hs-var">newImplicitBinder</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088357"><span class="hs-identifier hs-var">src_name</span></a></span><span> </span><span class="annot"><span class="annottext">OccName -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#mkDataConWorkerOcc"><span class="hs-identifier hs-var">mkDataConWorkerOcc</span></a></span><span>
</span><span id="line-129"></span><span>        </span><span class="hs-comment">-- This last one takes the name of the data constructor in the source</span><span>
</span><span id="line-130"></span><span>        </span><span class="hs-comment">-- code, which (for Haskell source anyway) will be in the DataName name</span><span>
</span><span id="line-131"></span><span>        </span><span class="hs-comment">-- space, and puts it into the VarName name space</span><span>
</span><span id="line-132"></span><span>
</span><span id="line-133"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; TcRnIf m n ()
forall m n. SDoc -&gt; TcRnIf m n ()
</span><a href="GHC.Tc.Utils.Monad.html#traceIf"><span class="hs-identifier hs-var">traceIf</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;buildDataCon 1&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088357"><span class="hs-identifier hs-var">src_name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-134"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681088338"><span class="annot"><span class="annottext">UniqSupply
</span><a href="#local-6989586621681088338"><span class="hs-identifier hs-var">us</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf m n UniqSupply
forall gbl lcl. TcRnIf gbl lcl UniqSupply
</span><a href="GHC.Tc.Utils.Monad.html#newUniqueSupply"><span class="hs-identifier hs-var">newUniqueSupply</span></a></span><span>
</span><span id="line-135"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681088336"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681088336"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env m n) DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-136"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681088334"><span class="annot"><span class="annottext">stupid_ctxt :: ThetaType
</span><a href="#local-6989586621681088334"><span class="hs-identifier hs-var hs-var">stupid_ctxt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; ThetaType -&gt; [TyVar] -&gt; ThetaType
</span><a href="GHC.Tc.TyCl.Build.html#mkDataConStupidTheta"><span class="hs-identifier hs-var">mkDataConStupidTheta</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681088344"><span class="hs-identifier hs-var">rep_tycon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Scaled Type -&gt; Type) -&gt; [Scaled Type] -&gt; ThetaType
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled Type -&gt; Type
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621681088346"><span class="hs-identifier hs-var">arg_tys</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088351"><span class="hs-identifier hs-var">univ_tvs</span></a></span><span>
</span><span id="line-137"></span><span>              </span><span id="local-6989586621681088332"><span class="annot"><span class="annottext">tag :: ConTag
</span><a href="#local-6989586621681088332"><span class="hs-identifier hs-var hs-var">tag</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NameEnv ConTag -&gt; Name -&gt; ConTag
forall a. NameEnv a -&gt; Name -&gt; a
</span><a href="GHC.Types.Name.Env.html#lookupNameEnv_NF"><span class="hs-identifier hs-var">lookupNameEnv_NF</span></a></span><span> </span><span class="annot"><span class="annottext">NameEnv ConTag
</span><a href="#local-6989586621681088343"><span class="hs-identifier hs-var">tag_map</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088357"><span class="hs-identifier hs-var">src_name</span></a></span><span>
</span><span id="line-138"></span><span>              </span><span class="hs-comment">-- See Note [Constructor tag allocation], fixes #14657</span><span>
</span><span id="line-139"></span><span>              </span><span id="local-6989586621681088330"><span class="annot"><span class="annottext">data_con :: DataCon
</span><a href="#local-6989586621681088330"><span class="hs-identifier hs-var hs-var">data_con</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name
-&gt; Bool
-&gt; Name
-&gt; [HsSrcBang]
-&gt; [FieldLabel]
-&gt; [TyVar]
-&gt; [TyVar]
-&gt; [InvisTVBinder]
-&gt; [EqSpec]
-&gt; ThetaType
-&gt; [Scaled Type]
-&gt; Type
-&gt; RuntimeRepInfo
-&gt; TyCon
-&gt; ConTag
-&gt; ThetaType
-&gt; TyVar
-&gt; DataConRep
-&gt; DataCon
</span><a href="GHC.Core.DataCon.html#mkDataCon"><span class="hs-identifier hs-var">mkDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088357"><span class="hs-identifier hs-var">src_name</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681088356"><span class="hs-identifier hs-var">declared_infix</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088355"><span class="hs-identifier hs-var">prom_info</span></a></span><span>
</span><span id="line-140"></span><span>                                   </span><span class="annot"><span class="annottext">[HsSrcBang]
</span><a href="#local-6989586621681088354"><span class="hs-identifier hs-var">src_bangs</span></a></span><span> </span><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681088352"><span class="hs-identifier hs-var">field_lbls</span></a></span><span>
</span><span id="line-141"></span><span>                                   </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088351"><span class="hs-identifier hs-var">univ_tvs</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088350"><span class="hs-identifier hs-var">ex_tvs</span></a></span><span> </span><span class="annot"><span class="annottext">[InvisTVBinder]
</span><a href="#local-6989586621681088349"><span class="hs-identifier hs-var">user_tvbs</span></a></span><span> </span><span class="annot"><span class="annottext">[EqSpec]
</span><a href="#local-6989586621681088348"><span class="hs-identifier hs-var">eq_spec</span></a></span><span> </span><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088347"><span class="hs-identifier hs-var">ctxt</span></a></span><span>
</span><span id="line-142"></span><span>                                   </span><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621681088346"><span class="hs-identifier hs-var">arg_tys</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088345"><span class="hs-identifier hs-var">res_ty</span></a></span><span> </span><span class="annot"><span class="annottext">RuntimeRepInfo
</span><a href="GHC.Core.TyCon.html#NoRRI"><span class="hs-identifier hs-var">NoRRI</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681088344"><span class="hs-identifier hs-var">rep_tycon</span></a></span><span> </span><span class="annot"><span class="annottext">ConTag
</span><a href="#local-6989586621681088332"><span class="hs-identifier hs-var">tag</span></a></span><span>
</span><span id="line-143"></span><span>                                   </span><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088334"><span class="hs-identifier hs-var">stupid_ctxt</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681088327"><span class="hs-identifier hs-var">dc_wrk</span></a></span><span> </span><span class="annot"><span class="annottext">DataConRep
</span><a href="#local-6989586621681088326"><span class="hs-identifier hs-var">dc_rep</span></a></span><span>
</span><span id="line-144"></span><span>              </span><span id="local-6989586621681088327"><span class="annot"><span class="annottext">dc_wrk :: TyVar
</span><a href="#local-6989586621681088327"><span class="hs-identifier hs-var hs-var">dc_wrk</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; DataCon -&gt; TyVar
</span><a href="GHC.Types.Id.Make.html#mkDataConWorkId"><span class="hs-identifier hs-var">mkDataConWorkId</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088340"><span class="hs-identifier hs-var">work_name</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681088330"><span class="hs-identifier hs-var">data_con</span></a></span><span>
</span><span id="line-145"></span><span>              </span><span id="local-6989586621681088326"><span class="annot"><span class="annottext">dc_rep :: DataConRep
</span><a href="#local-6989586621681088326"><span class="hs-identifier hs-var hs-var">dc_rep</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqSupply -&gt; UniqSM DataConRep -&gt; DataConRep
forall a. UniqSupply -&gt; UniqSM a -&gt; a
</span><a href="GHC.Types.Unique.Supply.html#initUs_"><span class="hs-identifier hs-var">initUs_</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSupply
</span><a href="#local-6989586621681088338"><span class="hs-identifier hs-var">us</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags
-&gt; FamInstEnvs
-&gt; Name
-&gt; Maybe [HsImplBang]
-&gt; DataCon
-&gt; UniqSM DataConRep
</span><a href="GHC.Types.Id.Make.html#mkDataConRep"><span class="hs-identifier hs-var">mkDataConRep</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681088336"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681088358"><span class="hs-identifier hs-var">fam_envs</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088342"><span class="hs-identifier hs-var">wrap_name</span></a></span><span>
</span><span id="line-146"></span><span>                                                </span><span class="annot"><span class="annottext">Maybe [HsImplBang]
</span><a href="#local-6989586621681088353"><span class="hs-identifier hs-var">impl_bangs</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681088330"><span class="hs-identifier hs-var">data_con</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-147"></span><span>
</span><span id="line-148"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; TcRnIf m n ()
forall m n. SDoc -&gt; TcRnIf m n ()
</span><a href="GHC.Tc.Utils.Monad.html#traceIf"><span class="hs-identifier hs-var">traceIf</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;buildDataCon 2&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088357"><span class="hs-identifier hs-var">src_name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-149"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; TcRnIf m n DataCon
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681088330"><span class="hs-identifier hs-var">data_con</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-150"></span><span>
</span><span id="line-151"></span><span>
</span><span id="line-152"></span><span class="hs-comment">-- The stupid context for a data constructor should be limited to</span><span>
</span><span id="line-153"></span><span class="hs-comment">-- the type variables mentioned in the arg_tys</span><span>
</span><span id="line-154"></span><span class="hs-comment">-- ToDo: Or functionally dependent on?</span><span>
</span><span id="line-155"></span><span class="hs-comment">--       This whole stupid theta thing is, well, stupid.</span><span>
</span><span id="line-156"></span><span class="annot"><a href="GHC.Tc.TyCl.Build.html#mkDataConStupidTheta"><span class="hs-identifier hs-type">mkDataConStupidTheta</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-157"></span><span id="mkDataConStupidTheta"><span class="annot"><span class="annottext">mkDataConStupidTheta :: TyCon -&gt; ThetaType -&gt; [TyVar] -&gt; ThetaType
</span><a href="GHC.Tc.TyCl.Build.html#mkDataConStupidTheta"><span class="hs-identifier hs-var hs-var">mkDataConStupidTheta</span></a></span></span><span> </span><span id="local-6989586621681088321"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681088321"><span class="hs-identifier hs-var">tycon</span></a></span></span><span> </span><span id="local-6989586621681088320"><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088320"><span class="hs-identifier hs-var">arg_tys</span></a></span></span><span> </span><span id="local-6989586621681088319"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088319"><span class="hs-identifier hs-var">univ_tvs</span></a></span></span><span>
</span><span id="line-158"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ThetaType -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088317"><span class="hs-identifier hs-var">stupid_theta</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>      </span><span class="hs-comment">-- The common case</span><span>
</span><span id="line-159"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Type -&gt; Bool) -&gt; ThetaType -&gt; ThetaType
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="#local-6989586621681088316"><span class="hs-identifier hs-var">in_arg_tys</span></a></span><span> </span><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088317"><span class="hs-identifier hs-var">stupid_theta</span></a></span><span>
</span><span id="line-160"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-161"></span><span>    </span><span id="local-6989586621681088313"><span class="annot"><span class="annottext">tc_subst :: TCvSubst
</span><a href="#local-6989586621681088313"><span class="hs-identifier hs-var hs-var">tc_subst</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; ThetaType -&gt; TCvSubst
HasDebugCallStack =&gt; [TyVar] -&gt; ThetaType -&gt; TCvSubst
</span><a href="GHC.Core.TyCo.Subst.html#zipTvSubst"><span class="hs-identifier hs-var">zipTvSubst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [TyVar]
</span><a href="GHC.Core.TyCon.html#tyConTyVars"><span class="hs-identifier hs-var hs-var">tyConTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681088321"><span class="hs-identifier hs-var">tycon</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-162"></span><span>                              </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TyVar] -&gt; ThetaType
</span><a href="GHC.Core.TyCo.Rep.html#mkTyVarTys"><span class="hs-identifier hs-var">mkTyVarTys</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088319"><span class="hs-identifier hs-var">univ_tvs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-163"></span><span>    </span><span id="local-6989586621681088317"><span class="annot"><span class="annottext">stupid_theta :: ThetaType
</span><a href="#local-6989586621681088317"><span class="hs-identifier hs-var hs-var">stupid_theta</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; TCvSubst -&gt; ThetaType -&gt; ThetaType
TCvSubst -&gt; ThetaType -&gt; ThetaType
</span><a href="GHC.Core.TyCo.Subst.html#substTheta"><span class="hs-identifier hs-var">substTheta</span></a></span><span> </span><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621681088313"><span class="hs-identifier hs-var">tc_subst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; ThetaType
</span><a href="GHC.Core.TyCon.html#tyConStupidTheta"><span class="hs-identifier hs-var">tyConStupidTheta</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681088321"><span class="hs-identifier hs-var">tycon</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-164"></span><span>        </span><span class="hs-comment">-- Start by instantiating the master copy of the</span><span>
</span><span id="line-165"></span><span>        </span><span class="hs-comment">-- stupid theta, taken from the TyCon</span><span>
</span><span id="line-166"></span><span>
</span><span id="line-167"></span><span>    </span><span id="local-6989586621681088307"><span class="annot"><span class="annottext">arg_tyvars :: VarSet
</span><a href="#local-6989586621681088307"><span class="hs-identifier hs-var hs-var">arg_tyvars</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ThetaType -&gt; VarSet
</span><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfTypes"><span class="hs-identifier hs-var">tyCoVarsOfTypes</span></a></span><span> </span><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088320"><span class="hs-identifier hs-var">arg_tys</span></a></span><span>
</span><span id="line-168"></span><span>    </span><span id="local-6989586621681088316"><span class="annot"><span class="annottext">in_arg_tys :: Type -&gt; Bool
</span><a href="#local-6989586621681088316"><span class="hs-identifier hs-var hs-var">in_arg_tys</span></a></span></span><span> </span><span id="local-6989586621681088305"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088305"><span class="hs-identifier hs-var">pred</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; VarSet
</span><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfType"><span class="hs-identifier hs-var">tyCoVarsOfType</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088305"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet -&gt; VarSet -&gt; Bool
</span><a href="GHC.Types.Var.Set.html#intersectsVarSet"><span class="hs-operator hs-var">`intersectsVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621681088307"><span class="hs-identifier hs-var">arg_tyvars</span></a></span><span>
</span><span id="line-169"></span><span>
</span><span id="line-170"></span><span>
</span><span id="line-171"></span><span class="hs-comment">------------------------------------------------------</span><span>
</span><span id="line-172"></span><span class="annot"><a href="GHC.Tc.TyCl.Build.html#buildPatSyn"><span class="hs-identifier hs-type">buildPatSyn</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-173"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span>
</span><span id="line-174"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#InvisTVBinder"><span class="hs-identifier hs-type">InvisTVBinder</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ThetaType"><span class="hs-identifier hs-type">ThetaType</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- ^ Univ and req</span><span>
</span><span id="line-175"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#InvisTVBinder"><span class="hs-identifier hs-type">InvisTVBinder</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ThetaType"><span class="hs-identifier hs-type">ThetaType</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- ^ Ex and prov</span><span>
</span><span id="line-176"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span>                       </span><span class="hs-comment">-- ^ Argument types</span><span>
</span><span id="line-177"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>                         </span><span class="hs-comment">-- ^ Result type</span><span>
</span><span id="line-178"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabel"><span class="hs-identifier hs-type">FieldLabel</span></a></span><span class="hs-special">]</span><span>                 </span><span class="hs-comment">-- ^ Field labels for</span><span>
</span><span id="line-179"></span><span>                                            </span><span class="hs-comment">--   a record pattern synonym</span><span>
</span><span id="line-180"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.PatSyn.html#PatSyn"><span class="hs-identifier hs-type">PatSyn</span></a></span><span>
</span><span id="line-181"></span><span id="buildPatSyn"><span class="annot"><span class="annottext">buildPatSyn :: Name
-&gt; Bool
-&gt; (TyVar, Bool)
-&gt; Maybe (TyVar, Bool)
-&gt; ([InvisTVBinder], ThetaType)
-&gt; ([InvisTVBinder], ThetaType)
-&gt; ThetaType
-&gt; Type
-&gt; [FieldLabel]
-&gt; PatSyn
</span><a href="GHC.Tc.TyCl.Build.html#buildPatSyn"><span class="hs-identifier hs-var hs-var">buildPatSyn</span></a></span></span><span> </span><span id="local-6989586621681088302"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088302"><span class="hs-identifier hs-var">src_name</span></a></span></span><span> </span><span id="local-6989586621681088301"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681088301"><span class="hs-identifier hs-var">declared_infix</span></a></span></span><span> </span><span id="local-6989586621681088300"><span class="annot"><span class="annottext">matcher :: (TyVar, Bool)
</span><a href="#local-6989586621681088300"><span class="hs-identifier hs-var">matcher</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621681088299"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681088299"><span class="hs-identifier hs-var">matcher_id</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681088298"><span class="annot"><span class="annottext">Maybe (TyVar, Bool)
</span><a href="#local-6989586621681088298"><span class="hs-identifier hs-var">builder</span></a></span></span><span>
</span><span id="line-182"></span><span>            </span><span class="hs-special">(</span><span id="local-6989586621681088297"><span class="annot"><span class="annottext">[InvisTVBinder]
</span><a href="#local-6989586621681088297"><span class="hs-identifier hs-var">univ_tvs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681088296"><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088296"><span class="hs-identifier hs-var">req_theta</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681088295"><span class="annot"><span class="annottext">[InvisTVBinder]
</span><a href="#local-6989586621681088295"><span class="hs-identifier hs-var">ex_tvs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681088294"><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088294"><span class="hs-identifier hs-var">prov_theta</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681088293"><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088293"><span class="hs-identifier hs-var">arg_tys</span></a></span></span><span>
</span><span id="line-183"></span><span>            </span><span id="local-6989586621681088292"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088292"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span> </span><span id="local-6989586621681088291"><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681088291"><span class="hs-identifier hs-var">field_labels</span></a></span></span><span>
</span><span id="line-184"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-comment">-- The assertion checks that the matcher is</span><span>
</span><span id="line-185"></span><span>    </span><span class="hs-comment">-- compatible with the pattern synonym</span><span>
</span><span id="line-186"></span><span>    </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-identifier">and</span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-identifier">univ_tvs</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">equalLength</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">univ_tvs1</span><span>
</span><span id="line-187"></span><span>                 </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ex_tvs</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">equalLength</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">ex_tvs1</span><span>
</span><span id="line-188"></span><span>                 </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">pat_ty</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">eqType</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">substTy</span><span> </span><span class="hs-identifier">subst</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">scaledThing</span><span> </span><span class="hs-identifier">pat_ty1</span><span class="hs-special">)</span><span>
</span><span id="line-189"></span><span>                 </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">prov_theta</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">eqTypes</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">substTys</span><span> </span><span class="hs-identifier">subst</span><span> </span><span class="hs-identifier">prov_theta1</span><span>
</span><span id="line-190"></span><span>                 </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">req_theta</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">eqTypes</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">substTys</span><span> </span><span class="hs-identifier">subst</span><span> </span><span class="hs-identifier">req_theta1</span><span>
</span><span id="line-191"></span><span>                 </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">compareArgTys</span><span> </span><span class="hs-identifier">arg_tys</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">substTys</span><span> </span><span class="hs-identifier">subst</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">map</span><span> </span><span class="hs-identifier">scaledThing</span><span> </span><span class="hs-identifier">arg_tys1</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-192"></span><span>                 </span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-193"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">vcat</span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">univ_tvs</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">twiddle</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">univ_tvs1</span><span>
</span><span id="line-194"></span><span>                    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">ex_tvs</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">twiddle</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">ex_tvs1</span><span>
</span><span id="line-195"></span><span>                    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">pat_ty</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">twiddle</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">pat_ty1</span><span>
</span><span id="line-196"></span><span>                    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">prov_theta</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">twiddle</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">prov_theta1</span><span>
</span><span id="line-197"></span><span>                    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">req_theta</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">twiddle</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">req_theta1</span><span>
</span><span id="line-198"></span><span>                    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">arg_tys</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">twiddle</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">arg_tys1</span><span class="hs-special">]</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-199"></span><span>    </span><span class="annot"><span class="annottext">Name
-&gt; Bool
-&gt; ([InvisTVBinder], ThetaType)
-&gt; ([InvisTVBinder], ThetaType)
-&gt; ThetaType
-&gt; Type
-&gt; (TyVar, Bool)
-&gt; Maybe (TyVar, Bool)
-&gt; [FieldLabel]
-&gt; PatSyn
</span><a href="GHC.Core.PatSyn.html#mkPatSyn"><span class="hs-identifier hs-var">mkPatSyn</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088302"><span class="hs-identifier hs-var">src_name</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681088301"><span class="hs-identifier hs-var">declared_infix</span></a></span><span>
</span><span id="line-200"></span><span>             </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[InvisTVBinder]
</span><a href="#local-6989586621681088297"><span class="hs-identifier hs-var">univ_tvs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088296"><span class="hs-identifier hs-var">req_theta</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[InvisTVBinder]
</span><a href="#local-6989586621681088295"><span class="hs-identifier hs-var">ex_tvs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088294"><span class="hs-identifier hs-var">prov_theta</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-201"></span><span>             </span><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088293"><span class="hs-identifier hs-var">arg_tys</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088292"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-202"></span><span>             </span><span class="annot"><span class="annottext">(TyVar, Bool)
</span><a href="#local-6989586621681088300"><span class="hs-identifier hs-var">matcher</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (TyVar, Bool)
</span><a href="#local-6989586621681088298"><span class="hs-identifier hs-var">builder</span></a></span><span> </span><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681088291"><span class="hs-identifier hs-var">field_labels</span></a></span><span>
</span><span id="line-203"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-204"></span><span>    </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyVar
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">TyVar
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681088286"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088286"><span class="hs-identifier hs-var">univ_tvs1</span></a></span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span id="local-6989586621681088277"><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088277"><span class="hs-identifier hs-var">req_theta1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681088270"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088270"><span class="hs-identifier hs-var">tau</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; ([TyVar], ThetaType, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitSigmaTy"><span class="hs-identifier hs-var">tcSplitSigmaTy</span></a></span><span> </span><span class="annot"><span class="annottext">(Type -&gt; ([TyVar], ThetaType, Type))
-&gt; Type -&gt; ([TyVar], ThetaType, Type)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; Type
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681088299"><span class="hs-identifier hs-var">matcher_id</span></a></span><span>
</span><span id="line-205"></span><span>    </span><span class="hs-special">(</span><span class="hs-special">[</span><span id="local-6989586621681088281"><span class="annot"><span class="annottext">Scaled Type
</span><a href="#local-6989586621681088281"><span class="hs-identifier hs-var">pat_ty1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681088267"><span class="annot"><span class="annottext">Scaled Type
</span><a href="#local-6989586621681088267"><span class="hs-identifier hs-var">cont_sigma</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Scaled Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; ([Scaled Type], Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTys"><span class="hs-identifier hs-var">tcSplitFunTys</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088270"><span class="hs-identifier hs-var">tau</span></a></span><span>
</span><span id="line-206"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681088285"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088285"><span class="hs-identifier hs-var">ex_tvs1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681088278"><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088278"><span class="hs-identifier hs-var">prov_theta1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681088265"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088265"><span class="hs-identifier hs-var">cont_tau</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; ([TyVar], ThetaType, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitSigmaTy"><span class="hs-identifier hs-var">tcSplitSigmaTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled Type -&gt; Type
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled Type
</span><a href="#local-6989586621681088267"><span class="hs-identifier hs-var">cont_sigma</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-207"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681088275"><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621681088275"><span class="hs-identifier hs-var">arg_tys1</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; ([Scaled Type], Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTys"><span class="hs-identifier hs-var">tcSplitFunTys</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088265"><span class="hs-identifier hs-var">cont_tau</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-208"></span><span>    </span><span id="local-6989586621681088272"><span class="annot"><span class="annottext">twiddle :: SDoc
</span><a href="#local-6989586621681088272"><span class="hs-identifier hs-var hs-var">twiddle</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'~'</span></span><span>
</span><span id="line-209"></span><span>    </span><span id="local-6989586621681088282"><span class="annot"><span class="annottext">subst :: TCvSubst
</span><a href="#local-6989586621681088282"><span class="hs-identifier hs-var hs-var">subst</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; ThetaType -&gt; TCvSubst
HasDebugCallStack =&gt; [TyVar] -&gt; ThetaType -&gt; TCvSubst
</span><a href="GHC.Core.TyCo.Subst.html#zipTvSubst"><span class="hs-identifier hs-var">zipTvSubst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088286"><span class="hs-identifier hs-var">univ_tvs1</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; [TyVar] -&gt; [TyVar]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088285"><span class="hs-identifier hs-var">ex_tvs1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-210"></span><span>                       </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TyVar] -&gt; ThetaType
</span><a href="GHC.Core.TyCo.Rep.html#mkTyVarTys"><span class="hs-identifier hs-var">mkTyVarTys</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[InvisTVBinder] -&gt; [TyVar]
forall tv argf. [VarBndr tv argf] -&gt; [tv]
</span><a href="GHC.Types.Var.html#binderVars"><span class="hs-identifier hs-var">binderVars</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[InvisTVBinder]
</span><a href="#local-6989586621681088297"><span class="hs-identifier hs-var">univ_tvs</span></a></span><span> </span><span class="annot"><span class="annottext">[InvisTVBinder] -&gt; [InvisTVBinder] -&gt; [InvisTVBinder]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[InvisTVBinder]
</span><a href="#local-6989586621681088295"><span class="hs-identifier hs-var">ex_tvs</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-211"></span><span>
</span><span id="line-212"></span><span>    </span><span class="hs-comment">-- For a nullary pattern synonym we add a single void argument to the</span><span>
</span><span id="line-213"></span><span>    </span><span class="hs-comment">-- matcher to preserve laziness in the case of unlifted types.</span><span>
</span><span id="line-214"></span><span>    </span><span class="hs-comment">-- See #12746</span><span>
</span><span id="line-215"></span><span>    </span><span class="annot"><a href="#local-6989586621681088276"><span class="hs-identifier hs-type">compareArgTys</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-216"></span><span>    </span><span id="local-6989586621681088276"><span class="annot"><span class="annottext">compareArgTys :: ThetaType -&gt; ThetaType -&gt; Bool
</span><a href="#local-6989586621681088276"><span class="hs-identifier hs-var hs-var">compareArgTys</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span id="local-6989586621681088261"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088261"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088261"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-operator hs-var">`eqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.Prim.html#voidPrimTy"><span class="hs-identifier hs-var">voidPrimTy</span></a></span><span>
</span><span id="line-217"></span><span>    </span><span class="annot"><a href="#local-6989586621681088276"><span class="hs-identifier hs-var">compareArgTys</span></a></span><span> </span><span id="local-6989586621681088260"><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088260"><span class="hs-identifier hs-var">arg_tys</span></a></span></span><span> </span><span id="local-6989586621681088259"><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088259"><span class="hs-identifier hs-var">matcher_arg_tys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088260"><span class="hs-identifier hs-var">arg_tys</span></a></span><span> </span><span class="annot"><span class="annottext">ThetaType -&gt; ThetaType -&gt; Bool
</span><a href="GHC.Core.Type.html#eqTypes"><span class="hs-operator hs-var">`eqTypes`</span></a></span><span> </span><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088259"><span class="hs-identifier hs-var">matcher_arg_tys</span></a></span><span>
</span><span id="line-218"></span><span>
</span><span id="line-219"></span><span>
</span><span id="line-220"></span><span class="hs-comment">------------------------------------------------------</span><span>
</span><span id="line-221"></span><span class="hs-keyword">type</span><span> </span><span id="TcMethInfo"><span class="annot"><a href="GHC.Tc.TyCl.Build.html#TcMethInfo"><span class="hs-identifier hs-var">TcMethInfo</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.TyCl.Build.html#MethInfo"><span class="hs-identifier hs-type">MethInfo</span></a></span><span>  </span><span class="hs-comment">-- this variant needs zonking</span><span>
</span><span id="line-222"></span><span class="hs-keyword">type</span><span> </span><span id="MethInfo"><span class="annot"><a href="GHC.Tc.TyCl.Build.html#MethInfo"><span class="hs-identifier hs-var">MethInfo</span></a></span></span><span>       </span><span class="hs-comment">-- A temporary intermediate, to communicate</span><span>
</span><span id="line-223"></span><span>                    </span><span class="hs-comment">-- between tcClassSigs and buildClass.</span><span>
</span><span id="line-224"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span>   </span><span class="hs-comment">-- Name of the class op</span><span>
</span><span id="line-225"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>   </span><span class="hs-comment">-- Type of the class op</span><span>
</span><span id="line-226"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Basic.html#DefMethSpec"><span class="hs-identifier hs-type">DefMethSpec</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-227"></span><span>         </span><span class="hs-comment">-- Nothing                    =&gt; no default method</span><span>
</span><span id="line-228"></span><span>         </span><span class="hs-comment">--</span><span>
</span><span id="line-229"></span><span>         </span><span class="hs-comment">-- Just VanillaDM             =&gt; There is an ordinary</span><span>
</span><span id="line-230"></span><span>         </span><span class="hs-comment">--                               polymorphic default method</span><span>
</span><span id="line-231"></span><span>         </span><span class="hs-comment">--</span><span>
</span><span id="line-232"></span><span>         </span><span class="hs-comment">-- Just (GenericDM (loc, ty)) =&gt; There is a generic default metho</span><span>
</span><span id="line-233"></span><span>         </span><span class="hs-comment">--                               Here is its type, and the location</span><span>
</span><span id="line-234"></span><span>         </span><span class="hs-comment">--                               of the type signature</span><span>
</span><span id="line-235"></span><span>         </span><span class="hs-comment">--    We need that location /only/ to attach it to the</span><span>
</span><span id="line-236"></span><span>         </span><span class="hs-comment">--    generic default method's Name; and we need /that/</span><span>
</span><span id="line-237"></span><span>         </span><span class="hs-comment">--    only to give the right location of an ambiguity error</span><span>
</span><span id="line-238"></span><span>         </span><span class="hs-comment">--    for the generic default method, spat out by checkValidClass</span><span>
</span><span id="line-239"></span><span>
</span><span id="line-240"></span><span id="local-6989586621681088539"><span id="local-6989586621681088540"><span class="annot"><a href="GHC.Tc.TyCl.Build.html#buildClass"><span class="hs-identifier hs-type">buildClass</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span>  </span><span class="hs-comment">-- Name of the class/tycon (they have the same Name)</span><span>
</span><span id="line-241"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCon.html#TyConBinder"><span class="hs-identifier hs-type">TyConBinder</span></a></span><span class="hs-special">]</span><span>                </span><span class="hs-comment">-- Of the tycon</span><span>
</span><span id="line-242"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#Role"><span class="hs-identifier hs-type">Role</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-243"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.Class.html#FunDep"><span class="hs-identifier hs-type">FunDep</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">]</span><span>               </span><span class="hs-comment">-- Functional dependencies</span><span>
</span><span id="line-244"></span><span>           </span><span class="hs-comment">-- Super classes, associated types, method info, minimal complete def.</span><span>
</span><span id="line-245"></span><span>           </span><span class="hs-comment">-- This is Nothing if the class is abstract.</span><span>
</span><span id="line-246"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#KnotTied"><span class="hs-identifier hs-type">KnotTied</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ThetaType"><span class="hs-identifier hs-type">ThetaType</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.Class.html#ClassATItem"><span class="hs-identifier hs-type">ClassATItem</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#KnotTied"><span class="hs-identifier hs-type">KnotTied</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.TyCl.Build.html#MethInfo"><span class="hs-identifier hs-type">MethInfo</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#ClassMinimalDef"><span class="hs-identifier hs-type">ClassMinimalDef</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-247"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRnIf"><span class="hs-identifier hs-type">TcRnIf</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681088540"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681088539"><span class="hs-identifier hs-type">n</span></a></span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span></span></span><span>
</span><span id="line-248"></span><span>
</span><span id="line-249"></span><span id="buildClass"><span class="annot"><span class="annottext">buildClass :: forall m n.
Name
-&gt; [TyConBinder]
-&gt; [Role]
-&gt; [FunDep TyVar]
-&gt; Maybe
     (ThetaType, [ClassATItem], [KnotTied MethInfo], ClassMinimalDef)
-&gt; TcRnIf m n Class
</span><a href="GHC.Tc.TyCl.Build.html#buildClass"><span class="hs-identifier hs-var hs-var">buildClass</span></a></span></span><span> </span><span id="local-6989586621681088232"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088232"><span class="hs-identifier hs-var">tycon_name</span></a></span></span><span> </span><span id="local-6989586621681088231"><span class="annot"><span class="annottext">[TyConBinder]
</span><a href="#local-6989586621681088231"><span class="hs-identifier hs-var">binders</span></a></span></span><span> </span><span id="local-6989586621681088230"><span class="annot"><span class="annottext">[Role]
</span><a href="#local-6989586621681088230"><span class="hs-identifier hs-var">roles</span></a></span></span><span> </span><span id="local-6989586621681088229"><span class="annot"><span class="annottext">[FunDep TyVar]
</span><a href="#local-6989586621681088229"><span class="hs-identifier hs-var">fds</span></a></span></span><span> </span><span class="annot"><span class="annottext">Maybe
  (ThetaType, [ClassATItem], [KnotTied MethInfo], ClassMinimalDef)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-250"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Class -&gt; IOEnv (Env m n) Class) -&gt; IOEnv (Env m n) Class
forall a env. (a -&gt; IOEnv env a) -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#fixM"><span class="hs-identifier hs-var">fixM</span></a></span><span>  </span><span class="annot"><span class="annottext">((Class -&gt; IOEnv (Env m n) Class) -&gt; IOEnv (Env m n) Class)
-&gt; (Class -&gt; IOEnv (Env m n) Class) -&gt; IOEnv (Env m n) Class
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621681088227"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681088227"><span class="hs-identifier hs-var">rec_clas</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>       </span><span class="hs-comment">-- Only name generation inside loop</span><span>
</span><span id="line-251"></span><span>    </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; TcRnIf m n ()
forall m n. SDoc -&gt; TcRnIf m n ()
</span><a href="GHC.Tc.Utils.Monad.html#traceIf"><span class="hs-identifier hs-var">traceIf</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;buildClass&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-252"></span><span>
</span><span id="line-253"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681088226"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088226"><span class="hs-identifier hs-var">tc_rep_name</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcRnIf m n Name
forall gbl lcl. Name -&gt; TcRnIf gbl lcl Name
</span><a href="GHC.Tc.TyCl.Build.html#newTyConRepName"><span class="hs-identifier hs-var">newTyConRepName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088232"><span class="hs-identifier hs-var">tycon_name</span></a></span><span>
</span><span id="line-254"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681088225"><span class="annot"><span class="annottext">univ_tvs :: [TyVar]
</span><a href="#local-6989586621681088225"><span class="hs-identifier hs-var hs-var">univ_tvs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyConBinder] -&gt; [TyVar]
forall tv argf. [VarBndr tv argf] -&gt; [tv]
</span><a href="GHC.Types.Var.html#binderVars"><span class="hs-identifier hs-var">binderVars</span></a></span><span> </span><span class="annot"><span class="annottext">[TyConBinder]
</span><a href="#local-6989586621681088231"><span class="hs-identifier hs-var">binders</span></a></span><span>
</span><span id="line-255"></span><span>              </span><span id="local-6989586621681088224"><span class="annot"><span class="annottext">tycon :: TyCon
</span><a href="#local-6989586621681088224"><span class="hs-identifier hs-var hs-var">tycon</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name
-&gt; [TyConBinder] -&gt; [Role] -&gt; AlgTyConRhs -&gt; Class -&gt; Name -&gt; TyCon
</span><a href="GHC.Core.TyCon.html#mkClassTyCon"><span class="hs-identifier hs-var">mkClassTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088232"><span class="hs-identifier hs-var">tycon_name</span></a></span><span> </span><span class="annot"><span class="annottext">[TyConBinder]
</span><a href="#local-6989586621681088231"><span class="hs-identifier hs-var">binders</span></a></span><span> </span><span class="annot"><span class="annottext">[Role]
</span><a href="#local-6989586621681088230"><span class="hs-identifier hs-var">roles</span></a></span><span>
</span><span id="line-256"></span><span>                                   </span><span class="annot"><span class="annottext">AlgTyConRhs
</span><a href="GHC.Core.TyCon.html#AbstractTyCon"><span class="hs-identifier hs-var">AbstractTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681088227"><span class="hs-identifier hs-var">rec_clas</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088226"><span class="hs-identifier hs-var">tc_rep_name</span></a></span><span>
</span><span id="line-257"></span><span>              </span><span id="local-6989586621681088221"><span class="annot"><span class="annottext">result :: Class
</span><a href="#local-6989586621681088221"><span class="hs-identifier hs-var hs-var">result</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; [TyVar] -&gt; [FunDep TyVar] -&gt; TyCon -&gt; Class
</span><a href="GHC.Core.Class.html#mkAbstractClass"><span class="hs-identifier hs-var">mkAbstractClass</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088232"><span class="hs-identifier hs-var">tycon_name</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088225"><span class="hs-identifier hs-var">univ_tvs</span></a></span><span> </span><span class="annot"><span class="annottext">[FunDep TyVar]
</span><a href="#local-6989586621681088229"><span class="hs-identifier hs-var">fds</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681088224"><span class="hs-identifier hs-var">tycon</span></a></span><span>
</span><span id="line-258"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; TcRnIf m n ()
forall m n. SDoc -&gt; TcRnIf m n ()
</span><a href="GHC.Tc.Utils.Monad.html#traceIf"><span class="hs-identifier hs-var">traceIf</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;buildClass&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681088224"><span class="hs-identifier hs-var">tycon</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-259"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Class -&gt; IOEnv (Env m n) Class
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681088221"><span class="hs-identifier hs-var">result</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-260"></span><span>
</span><span id="line-261"></span><span class="annot"><a href="GHC.Tc.TyCl.Build.html#buildClass"><span class="hs-identifier hs-var">buildClass</span></a></span><span> </span><span id="local-6989586621681088219"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088219"><span class="hs-identifier hs-var">tycon_name</span></a></span></span><span> </span><span id="local-6989586621681088218"><span class="annot"><span class="annottext">[TyConBinder]
</span><a href="#local-6989586621681088218"><span class="hs-identifier hs-var">binders</span></a></span></span><span> </span><span id="local-6989586621681088217"><span class="annot"><span class="annottext">[Role]
</span><a href="#local-6989586621681088217"><span class="hs-identifier hs-var">roles</span></a></span></span><span> </span><span id="local-6989586621681088216"><span class="annot"><span class="annottext">[FunDep TyVar]
</span><a href="#local-6989586621681088216"><span class="hs-identifier hs-var">fds</span></a></span></span><span>
</span><span id="line-262"></span><span>           </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681088215"><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088215"><span class="hs-identifier hs-var">sc_theta</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681088214"><span class="annot"><span class="annottext">[ClassATItem]
</span><a href="#local-6989586621681088214"><span class="hs-identifier hs-var">at_items</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681088213"><span class="annot"><span class="annottext">[KnotTied MethInfo]
</span><a href="#local-6989586621681088213"><span class="hs-identifier hs-var">sig_stuff</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681088212"><span class="annot"><span class="annottext">ClassMinimalDef
</span><a href="#local-6989586621681088212"><span class="hs-identifier hs-var">mindef</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-263"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Class -&gt; IOEnv (Env m n) Class) -&gt; IOEnv (Env m n) Class
forall a env. (a -&gt; IOEnv env a) -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#fixM"><span class="hs-identifier hs-var">fixM</span></a></span><span>  </span><span class="annot"><span class="annottext">((Class -&gt; IOEnv (Env m n) Class) -&gt; IOEnv (Env m n) Class)
-&gt; (Class -&gt; IOEnv (Env m n) Class) -&gt; IOEnv (Env m n) Class
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621681088211"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681088211"><span class="hs-identifier hs-var">rec_clas</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>       </span><span class="hs-comment">-- Only name generation inside loop</span><span>
</span><span id="line-264"></span><span>    </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; TcRnIf m n ()
forall m n. SDoc -&gt; TcRnIf m n ()
</span><a href="GHC.Tc.Utils.Monad.html#traceIf"><span class="hs-identifier hs-var">traceIf</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;buildClass&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-265"></span><span>
</span><span id="line-266"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681088210"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088210"><span class="hs-identifier hs-var">datacon_name</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; (OccName -&gt; OccName) -&gt; TcRnIf m n Name
forall m n. Name -&gt; (OccName -&gt; OccName) -&gt; TcRnIf m n Name
</span><a href="GHC.Tc.TyCl.Build.html#newImplicitBinder"><span class="hs-identifier hs-var">newImplicitBinder</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088219"><span class="hs-identifier hs-var">tycon_name</span></a></span><span> </span><span class="annot"><span class="annottext">OccName -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#mkClassDataConOcc"><span class="hs-identifier hs-var">mkClassDataConOcc</span></a></span><span>
</span><span id="line-267"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681088208"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088208"><span class="hs-identifier hs-var">tc_rep_name</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcRnIf m n Name
forall gbl lcl. Name -&gt; TcRnIf gbl lcl Name
</span><a href="GHC.Tc.TyCl.Build.html#newTyConRepName"><span class="hs-identifier hs-var">newTyConRepName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088219"><span class="hs-identifier hs-var">tycon_name</span></a></span><span>
</span><span id="line-268"></span><span>
</span><span id="line-269"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681088207"><span class="annot"><span class="annottext">[ClassOpItem]
</span><a href="#local-6989586621681088207"><span class="hs-identifier hs-var">op_items</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(KnotTied MethInfo -&gt; IOEnv (Env m n) ClassOpItem)
-&gt; [KnotTied MethInfo] -&gt; IOEnv (Env m n) [ClassOpItem]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Class -&gt; KnotTied MethInfo -&gt; IOEnv (Env m n) ClassOpItem
forall n m. Class -&gt; KnotTied MethInfo -&gt; TcRnIf n m ClassOpItem
</span><a href="#local-6989586621681088205"><span class="hs-identifier hs-var">mk_op_item</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681088211"><span class="hs-identifier hs-var">rec_clas</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[KnotTied MethInfo]
</span><a href="#local-6989586621681088213"><span class="hs-identifier hs-var">sig_stuff</span></a></span><span>
</span><span id="line-270"></span><span>                        </span><span class="hs-comment">-- Build the selector id and default method id</span><span>
</span><span id="line-271"></span><span>
</span><span id="line-272"></span><span>              </span><span class="hs-comment">-- Make selectors for the superclasses</span><span>
</span><span id="line-273"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681088204"><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681088204"><span class="hs-identifier hs-var">sc_sel_names</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(ConTag -&gt; TcRnIf m n Name) -&gt; [ConTag] -&gt; IOEnv (Env m n) [Name]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span>  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; (OccName -&gt; OccName) -&gt; TcRnIf m n Name
forall m n. Name -&gt; (OccName -&gt; OccName) -&gt; TcRnIf m n Name
</span><a href="GHC.Tc.TyCl.Build.html#newImplicitBinder"><span class="hs-identifier hs-var">newImplicitBinder</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088219"><span class="hs-identifier hs-var">tycon_name</span></a></span><span> </span><span class="annot"><span class="annottext">((OccName -&gt; OccName) -&gt; TcRnIf m n Name)
-&gt; (ConTag -&gt; OccName -&gt; OccName) -&gt; ConTag -&gt; TcRnIf m n Name
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ConTag -&gt; OccName -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#mkSuperDictSelOcc"><span class="hs-identifier hs-var">mkSuperDictSelOcc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-274"></span><span>                                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ThetaType -&gt; [ConTag] -&gt; [ConTag]
forall b a. [b] -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#takeList"><span class="hs-identifier hs-var">takeList</span></a></span><span> </span><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088215"><span class="hs-identifier hs-var">sc_theta</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ConTag
</span><a href="GHC.Types.Basic.html#fIRST_TAG"><span class="hs-identifier hs-var">fIRST_TAG</span></a></span><span class="hs-glyph">..</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-275"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681088199"><span class="annot"><span class="annottext">sc_sel_ids :: [TyVar]
</span><a href="#local-6989586621681088199"><span class="hs-identifier hs-var hs-var">sc_sel_ids</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Class -&gt; TyVar
</span><a href="GHC.Types.Id.Make.html#mkDictSelId"><span class="hs-identifier hs-var">mkDictSelId</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088197"><span class="hs-identifier hs-var">sc_name</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681088211"><span class="hs-identifier hs-var">rec_clas</span></a></span><span>
</span><span id="line-276"></span><span>                           </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681088197"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088197"><span class="hs-identifier hs-var">sc_name</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681088204"><span class="hs-identifier hs-var">sc_sel_names</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-277"></span><span>              </span><span class="hs-comment">-- We number off the Dict superclass selectors, 1, 2, 3 etc so that we</span><span>
</span><span id="line-278"></span><span>              </span><span class="hs-comment">-- can construct names for the selectors. Thus</span><span>
</span><span id="line-279"></span><span>              </span><span class="hs-comment">--      class (C a, C b) =&gt; D a b where ...</span><span>
</span><span id="line-280"></span><span>              </span><span class="hs-comment">-- gives superclass selectors</span><span>
</span><span id="line-281"></span><span>              </span><span class="hs-comment">--      D_sc1, D_sc2</span><span>
</span><span id="line-282"></span><span>              </span><span class="hs-comment">-- (We used to call them D_C, but now we can have two different</span><span>
</span><span id="line-283"></span><span>              </span><span class="hs-comment">--  superclasses both called C!)</span><span>
</span><span id="line-284"></span><span>
</span><span id="line-285"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681088196"><span class="annot"><span class="annottext">use_newtype :: Bool
</span><a href="#local-6989586621681088196"><span class="hs-identifier hs-var hs-var">use_newtype</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ThetaType -&gt; Bool
forall a. [a] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#isSingleton"><span class="hs-identifier hs-var">isSingleton</span></a></span><span> </span><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088194"><span class="hs-identifier hs-var">arg_tys</span></a></span><span>
</span><span id="line-286"></span><span>                </span><span class="hs-comment">-- Use a newtype if the data constructor</span><span>
</span><span id="line-287"></span><span>                </span><span class="hs-comment">--   (a) has exactly one value field</span><span>
</span><span id="line-288"></span><span>                </span><span class="hs-comment">--       i.e. exactly one operation or superclass taken together</span><span>
</span><span id="line-289"></span><span>                </span><span class="hs-comment">--   (b) that value is of lifted type (which they always are, because</span><span>
</span><span id="line-290"></span><span>                </span><span class="hs-comment">--       we box equality superclasses)</span><span>
</span><span id="line-291"></span><span>                </span><span class="hs-comment">-- See note [Class newtypes and equality predicates]</span><span>
</span><span id="line-292"></span><span>
</span><span id="line-293"></span><span>                </span><span class="hs-comment">-- We treat the dictionary superclasses as ordinary arguments.</span><span>
</span><span id="line-294"></span><span>                </span><span class="hs-comment">-- That means that in the case of</span><span>
</span><span id="line-295"></span><span>                </span><span class="hs-comment">--     class C a =&gt; D a</span><span>
</span><span id="line-296"></span><span>                </span><span class="hs-comment">-- we don't get a newtype with no arguments!</span><span>
</span><span id="line-297"></span><span>              </span><span id="local-6989586621681088193"><span class="annot"><span class="annottext">args :: [Name]
</span><a href="#local-6989586621681088193"><span class="hs-identifier hs-var hs-var">args</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681088204"><span class="hs-identifier hs-var">sc_sel_names</span></a></span><span> </span><span class="annot"><span class="annottext">[Name] -&gt; [Name] -&gt; [Name]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681088192"><span class="hs-identifier hs-var">op_names</span></a></span><span>
</span><span id="line-298"></span><span>              </span><span id="local-6989586621681088191"><span class="annot"><span class="annottext">op_tys :: ThetaType
</span><a href="#local-6989586621681088191"><span class="hs-identifier hs-var hs-var">op_tys</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088190"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span id="local-6989586621681088190"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088190"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Maybe (DefMethSpec (SrcSpan, Type))
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[KnotTied MethInfo]
</span><a href="#local-6989586621681088213"><span class="hs-identifier hs-var">sig_stuff</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-299"></span><span>              </span><span id="local-6989586621681088192"><span class="annot"><span class="annottext">op_names :: [Name]
</span><a href="#local-6989586621681088192"><span class="hs-identifier hs-var hs-var">op_names</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088189"><span class="hs-identifier hs-var">op</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681088189"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088189"><span class="hs-identifier hs-var">op</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Maybe (DefMethSpec (SrcSpan, Type))
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[KnotTied MethInfo]
</span><a href="#local-6989586621681088213"><span class="hs-identifier hs-var">sig_stuff</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-300"></span><span>              </span><span id="local-6989586621681088194"><span class="annot"><span class="annottext">arg_tys :: ThetaType
</span><a href="#local-6989586621681088194"><span class="hs-identifier hs-var hs-var">arg_tys</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088215"><span class="hs-identifier hs-var">sc_theta</span></a></span><span> </span><span class="annot"><span class="annottext">ThetaType -&gt; ThetaType -&gt; ThetaType
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088191"><span class="hs-identifier hs-var">op_tys</span></a></span><span>
</span><span id="line-301"></span><span>              </span><span id="local-6989586621681088188"><span class="annot"><span class="annottext">rec_tycon :: TyCon
</span><a href="#local-6989586621681088188"><span class="hs-identifier hs-var hs-var">rec_tycon</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Class -&gt; TyCon
</span><a href="GHC.Core.Class.html#classTyCon"><span class="hs-identifier hs-var hs-var">classTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681088211"><span class="hs-identifier hs-var">rec_clas</span></a></span><span>
</span><span id="line-302"></span><span>              </span><span id="local-6989586621681088186"><span class="annot"><span class="annottext">univ_bndrs :: [InvisTVBinder]
</span><a href="#local-6989586621681088186"><span class="hs-identifier hs-var hs-var">univ_bndrs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyConBinder] -&gt; [InvisTVBinder]
</span><a href="GHC.Core.TyCon.html#tyConInvisTVBinders"><span class="hs-identifier hs-var">tyConInvisTVBinders</span></a></span><span> </span><span class="annot"><span class="annottext">[TyConBinder]
</span><a href="#local-6989586621681088218"><span class="hs-identifier hs-var">binders</span></a></span><span>
</span><span id="line-303"></span><span>              </span><span id="local-6989586621681088184"><span class="annot"><span class="annottext">univ_tvs :: [TyVar]
</span><a href="#local-6989586621681088184"><span class="hs-identifier hs-var hs-var">univ_tvs</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[InvisTVBinder] -&gt; [TyVar]
forall tv argf. [VarBndr tv argf] -&gt; [tv]
</span><a href="GHC.Types.Var.html#binderVars"><span class="hs-identifier hs-var">binderVars</span></a></span><span> </span><span class="annot"><span class="annottext">[InvisTVBinder]
</span><a href="#local-6989586621681088186"><span class="hs-identifier hs-var">univ_bndrs</span></a></span><span>
</span><span id="line-304"></span><span>
</span><span id="line-305"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681088183"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088183"><span class="hs-identifier hs-var">rep_nm</span></a></span></span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcRnIf m n Name
forall gbl lcl. Name -&gt; TcRnIf gbl lcl Name
</span><a href="GHC.Tc.TyCl.Build.html#newTyConRepName"><span class="hs-identifier hs-var">newTyConRepName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088210"><span class="hs-identifier hs-var">datacon_name</span></a></span><span>
</span><span id="line-306"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681088182"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681088182"><span class="hs-identifier hs-var">dict_con</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
-&gt; Name
-&gt; Bool
-&gt; Name
-&gt; [HsSrcBang]
-&gt; Maybe [HsImplBang]
-&gt; [FieldLabel]
-&gt; [TyVar]
-&gt; [TyVar]
-&gt; [InvisTVBinder]
-&gt; [EqSpec]
-&gt; ThetaType
-&gt; [Scaled Type]
-&gt; Type
-&gt; TyCon
-&gt; NameEnv ConTag
-&gt; TcRnIf m n DataCon
forall m n.
FamInstEnvs
-&gt; Name
-&gt; Bool
-&gt; Name
-&gt; [HsSrcBang]
-&gt; Maybe [HsImplBang]
-&gt; [FieldLabel]
-&gt; [TyVar]
-&gt; [TyVar]
-&gt; [InvisTVBinder]
-&gt; [EqSpec]
-&gt; ThetaType
-&gt; [Scaled Type]
-&gt; Type
-&gt; TyCon
-&gt; NameEnv ConTag
-&gt; TcRnIf m n DataCon
</span><a href="GHC.Tc.TyCl.Build.html#buildDataCon"><span class="hs-identifier hs-var">buildDataCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; FamInstEnvs
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;buildClass: FamInstEnvs&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-307"></span><span>                                   </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088210"><span class="hs-identifier hs-var">datacon_name</span></a></span><span>
</span><span id="line-308"></span><span>                                   </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>        </span><span class="hs-comment">-- Not declared infix</span><span>
</span><span id="line-309"></span><span>                                   </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088183"><span class="hs-identifier hs-var">rep_nm</span></a></span><span>
</span><span id="line-310"></span><span>                                   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Name -&gt; HsSrcBang) -&gt; [Name] -&gt; [HsSrcBang]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsSrcBang -&gt; Name -&gt; HsSrcBang
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">HsSrcBang
</span><a href="#local-6989586621681088179"><span class="hs-identifier hs-var">no_bang</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681088193"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-311"></span><span>                                   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[HsImplBang] -&gt; Maybe [HsImplBang]
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Name -&gt; HsImplBang) -&gt; [Name] -&gt; [HsImplBang]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsImplBang -&gt; Name -&gt; HsImplBang
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">HsImplBang
</span><a href="GHC.Core.DataCon.html#HsLazy"><span class="hs-identifier hs-var">HsLazy</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681088193"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-312"></span><span>                                   </span><span class="hs-special">[</span><span class="hs-comment">{- No fields -}</span><span class="hs-special">]</span><span>
</span><span id="line-313"></span><span>                                   </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088184"><span class="hs-identifier hs-var">univ_tvs</span></a></span><span>
</span><span id="line-314"></span><span>                                   </span><span class="hs-special">[</span><span class="hs-comment">{- no existentials -}</span><span class="hs-special">]</span><span>
</span><span id="line-315"></span><span>                                   </span><span class="annot"><span class="annottext">[InvisTVBinder]
</span><a href="#local-6989586621681088186"><span class="hs-identifier hs-var">univ_bndrs</span></a></span><span>
</span><span id="line-316"></span><span>                                   </span><span class="hs-special">[</span><span class="hs-comment">{- No GADT equalities -}</span><span class="hs-special">]</span><span>
</span><span id="line-317"></span><span>                                   </span><span class="hs-special">[</span><span class="hs-comment">{- No theta -}</span><span class="hs-special">]</span><span>
</span><span id="line-318"></span><span>                                   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Type -&gt; Scaled Type) -&gt; ThetaType -&gt; [Scaled Type]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Scaled Type
forall a. a -&gt; Scaled a
</span><a href="GHC.Core.Type.html#unrestricted"><span class="hs-identifier hs-var">unrestricted</span></a></span><span> </span><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088194"><span class="hs-identifier hs-var">arg_tys</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- type classes are unrestricted</span><span>
</span><span id="line-319"></span><span>                                   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; ThetaType -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681088188"><span class="hs-identifier hs-var">rec_tycon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TyVar] -&gt; ThetaType
</span><a href="GHC.Core.TyCo.Rep.html#mkTyVarTys"><span class="hs-identifier hs-var">mkTyVarTys</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088184"><span class="hs-identifier hs-var">univ_tvs</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-320"></span><span>                                   </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681088188"><span class="hs-identifier hs-var">rec_tycon</span></a></span><span>
</span><span id="line-321"></span><span>                                   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; NameEnv ConTag
</span><a href="GHC.Core.TyCon.html#mkTyConTagMap"><span class="hs-identifier hs-var">mkTyConTagMap</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681088188"><span class="hs-identifier hs-var">rec_tycon</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-322"></span><span>
</span><span id="line-323"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681088174"><span class="annot"><span class="annottext">AlgTyConRhs
</span><a href="#local-6989586621681088174"><span class="hs-identifier hs-var">rhs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-324"></span><span>                  </span><span class="annot"><span class="annottext">()
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681088196"><span class="hs-identifier hs-var">use_newtype</span></a></span><span>
</span><span id="line-325"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TyCon -&gt; DataCon -&gt; IOEnv (Env m n) AlgTyConRhs
forall m n. Name -&gt; TyCon -&gt; DataCon -&gt; TcRnIf m n AlgTyConRhs
</span><a href="GHC.Tc.TyCl.Build.html#mkNewTyConRhs"><span class="hs-identifier hs-var">mkNewTyConRhs</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088219"><span class="hs-identifier hs-var">tycon_name</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681088188"><span class="hs-identifier hs-var">rec_tycon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681088182"><span class="hs-identifier hs-var">dict_con</span></a></span><span>
</span><span id="line-326"></span><span>                    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="GHC.Builtin.Types.html#isCTupleTyConName"><span class="hs-identifier hs-var">isCTupleTyConName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088219"><span class="hs-identifier hs-var">tycon_name</span></a></span><span>
</span><span id="line-327"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">AlgTyConRhs -&gt; IOEnv (Env m n) AlgTyConRhs
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TupleTyCon :: DataCon -&gt; TupleSort -&gt; AlgTyConRhs
</span><a href="GHC.Core.TyCon.html#TupleTyCon"><span class="hs-identifier hs-type">TupleTyCon</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">data_con :: DataCon
</span><a href="GHC.Core.TyCon.html#data_con"><span class="hs-identifier hs-var">data_con</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681088182"><span class="hs-identifier hs-var">dict_con</span></a></span><span>
</span><span id="line-328"></span><span>                                          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">tup_sort :: TupleSort
</span><a href="GHC.Core.TyCon.html#tup_sort"><span class="hs-identifier hs-var">tup_sort</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TupleSort
</span><a href="GHC.Types.Basic.html#ConstraintTuple"><span class="hs-identifier hs-var">ConstraintTuple</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-329"></span><span>                    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-330"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">AlgTyConRhs -&gt; IOEnv (Env m n) AlgTyConRhs
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[DataCon] -&gt; AlgTyConRhs
</span><a href="GHC.Core.TyCon.html#mkDataTyConRhs"><span class="hs-identifier hs-var">mkDataTyConRhs</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681088182"><span class="hs-identifier hs-var">dict_con</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-331"></span><span>
</span><span id="line-332"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681088169"><span class="annot"><span class="annottext">tycon :: TyCon
</span><a href="#local-6989586621681088169"><span class="hs-identifier hs-var hs-var">tycon</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name
-&gt; [TyConBinder] -&gt; [Role] -&gt; AlgTyConRhs -&gt; Class -&gt; Name -&gt; TyCon
</span><a href="GHC.Core.TyCon.html#mkClassTyCon"><span class="hs-identifier hs-var">mkClassTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088219"><span class="hs-identifier hs-var">tycon_name</span></a></span><span> </span><span class="annot"><span class="annottext">[TyConBinder]
</span><a href="#local-6989586621681088218"><span class="hs-identifier hs-var">binders</span></a></span><span> </span><span class="annot"><span class="annottext">[Role]
</span><a href="#local-6989586621681088217"><span class="hs-identifier hs-var">roles</span></a></span><span>
</span><span id="line-333"></span><span>                                     </span><span class="annot"><span class="annottext">AlgTyConRhs
</span><a href="#local-6989586621681088174"><span class="hs-identifier hs-var">rhs</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681088211"><span class="hs-identifier hs-var">rec_clas</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088208"><span class="hs-identifier hs-var">tc_rep_name</span></a></span><span>
</span><span id="line-334"></span><span>                </span><span class="hs-comment">-- A class can be recursive, and in the case of newtypes</span><span>
</span><span id="line-335"></span><span>                </span><span class="hs-comment">-- this matters.  For example</span><span>
</span><span id="line-336"></span><span>                </span><span class="hs-comment">--      class C a where { op :: C b =&gt; a -&gt; b -&gt; Int }</span><span>
</span><span id="line-337"></span><span>                </span><span class="hs-comment">-- Because C has only one operation, it is represented by</span><span>
</span><span id="line-338"></span><span>                </span><span class="hs-comment">-- a newtype, and it should be a *recursive* newtype.</span><span>
</span><span id="line-339"></span><span>                </span><span class="hs-comment">-- [If we don't make it a recursive newtype, we'll expand the</span><span>
</span><span id="line-340"></span><span>                </span><span class="hs-comment">-- newtype like a synonym, but that will lead to an infinite</span><span>
</span><span id="line-341"></span><span>                </span><span class="hs-comment">-- type]</span><span>
</span><span id="line-342"></span><span>
</span><span id="line-343"></span><span>              </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681088168"><span class="annot"><span class="annottext">result :: Class
</span><a href="#local-6989586621681088168"><span class="hs-identifier hs-var hs-var">result</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name
-&gt; [TyVar]
-&gt; [FunDep TyVar]
-&gt; ThetaType
-&gt; [TyVar]
-&gt; [ClassATItem]
-&gt; [ClassOpItem]
-&gt; ClassMinimalDef
-&gt; TyCon
-&gt; Class
</span><a href="GHC.Core.Class.html#mkClass"><span class="hs-identifier hs-var">mkClass</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088219"><span class="hs-identifier hs-var">tycon_name</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088184"><span class="hs-identifier hs-var">univ_tvs</span></a></span><span> </span><span class="annot"><span class="annottext">[FunDep TyVar]
</span><a href="#local-6989586621681088216"><span class="hs-identifier hs-var">fds</span></a></span><span>
</span><span id="line-344"></span><span>                                 </span><span class="annot"><span class="annottext">ThetaType
</span><a href="#local-6989586621681088215"><span class="hs-identifier hs-var">sc_theta</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681088199"><span class="hs-identifier hs-var">sc_sel_ids</span></a></span><span> </span><span class="annot"><span class="annottext">[ClassATItem]
</span><a href="#local-6989586621681088214"><span class="hs-identifier hs-var">at_items</span></a></span><span>
</span><span id="line-345"></span><span>                                 </span><span class="annot"><span class="annottext">[ClassOpItem]
</span><a href="#local-6989586621681088207"><span class="hs-identifier hs-var">op_items</span></a></span><span> </span><span class="annot"><span class="annottext">ClassMinimalDef
</span><a href="#local-6989586621681088212"><span class="hs-identifier hs-var">mindef</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681088169"><span class="hs-identifier hs-var">tycon</span></a></span><span>
</span><span id="line-346"></span><span>              </span><span class="hs-special">}</span><span>
</span><span id="line-347"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; TcRnIf m n ()
forall m n. SDoc -&gt; TcRnIf m n ()
</span><a href="GHC.Tc.Utils.Monad.html#traceIf"><span class="hs-identifier hs-var">traceIf</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;buildClass&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681088169"><span class="hs-identifier hs-var">tycon</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-348"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Class -&gt; IOEnv (Env m n) Class
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681088168"><span class="hs-identifier hs-var">result</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-349"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-350"></span><span>    </span><span id="local-6989586621681088179"><span class="annot"><span class="annottext">no_bang :: HsSrcBang
</span><a href="#local-6989586621681088179"><span class="hs-identifier hs-var hs-var">no_bang</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SourceText -&gt; SrcUnpackedness -&gt; SrcStrictness -&gt; HsSrcBang
</span><a href="GHC.Core.DataCon.html#HsSrcBang"><span class="hs-identifier hs-var">HsSrcBang</span></a></span><span> </span><span class="annot"><span class="annottext">SourceText
</span><a href="GHC.Types.Basic.html#NoSourceText"><span class="hs-identifier hs-var">NoSourceText</span></a></span><span> </span><span class="annot"><span class="annottext">SrcUnpackedness
</span><a href="GHC.Core.DataCon.html#NoSrcUnpack"><span class="hs-identifier hs-var">NoSrcUnpack</span></a></span><span> </span><span class="annot"><span class="annottext">SrcStrictness
</span><a href="GHC.Core.DataCon.html#NoSrcStrict"><span class="hs-identifier hs-var">NoSrcStrict</span></a></span><span>
</span><span id="line-351"></span><span>
</span><span id="line-352"></span><span>    </span><span id="local-6989586621681088525"><span id="local-6989586621681088526"><span class="annot"><a href="#local-6989586621681088205"><span class="hs-identifier hs-type">mk_op_item</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.TyCl.Build.html#TcMethInfo"><span class="hs-identifier hs-type">TcMethInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRnIf"><span class="hs-identifier hs-type">TcRnIf</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681088526"><span class="hs-identifier hs-type">n</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681088525"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="GHC.Core.Class.html#ClassOpItem"><span class="hs-identifier hs-type">ClassOpItem</span></a></span></span></span><span>
</span><span id="line-353"></span><span>    </span><span id="local-6989586621681088205"><span class="annot"><span class="annottext">mk_op_item :: forall n m. Class -&gt; KnotTied MethInfo -&gt; TcRnIf n m ClassOpItem
</span><a href="#local-6989586621681088205"><span class="hs-identifier hs-var hs-var">mk_op_item</span></a></span></span><span> </span><span id="local-6989586621681088160"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681088160"><span class="hs-identifier hs-var">rec_clas</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681088159"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088159"><span class="hs-identifier hs-var">op_name</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681088158"><span class="annot"><span class="annottext">Maybe (DefMethSpec (SrcSpan, Type))
</span><a href="#local-6989586621681088158"><span class="hs-identifier hs-var">dm_spec</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-354"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681088157"><span class="annot"><span class="annottext">Maybe (Name, DefMethSpec Type)
</span><a href="#local-6989586621681088157"><span class="hs-identifier hs-var">dm_info</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name
-&gt; Maybe (DefMethSpec (SrcSpan, Type))
-&gt; TcRnIf n m (Maybe (Name, DefMethSpec Type))
forall n m.
Name
-&gt; Maybe (DefMethSpec (SrcSpan, Type))
-&gt; TcRnIf n m (Maybe (Name, DefMethSpec Type))
</span><a href="#local-6989586621681088156"><span class="hs-identifier hs-var">mk_dm_info</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088159"><span class="hs-identifier hs-var">op_name</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (DefMethSpec (SrcSpan, Type))
</span><a href="#local-6989586621681088158"><span class="hs-identifier hs-var">dm_spec</span></a></span><span>
</span><span id="line-355"></span><span>           </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">ClassOpItem -&gt; TcRnIf n m ClassOpItem
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; Class -&gt; TyVar
</span><a href="GHC.Types.Id.Make.html#mkDictSelId"><span class="hs-identifier hs-var">mkDictSelId</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088159"><span class="hs-identifier hs-var">op_name</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681088160"><span class="hs-identifier hs-var">rec_clas</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe (Name, DefMethSpec Type)
</span><a href="#local-6989586621681088157"><span class="hs-identifier hs-var">dm_info</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-356"></span><span>
</span><span id="line-357"></span><span>    </span><span id="local-6989586621681088505"><span id="local-6989586621681088506"><span class="annot"><a href="#local-6989586621681088156"><span class="hs-identifier hs-type">mk_dm_info</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Basic.html#DefMethSpec"><span class="hs-identifier hs-type">DefMethSpec</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-358"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRnIf"><span class="hs-identifier hs-type">TcRnIf</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681088506"><span class="hs-identifier hs-type">n</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681088505"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#DefMethSpec"><span class="hs-identifier hs-type">DefMethSpec</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span></span></span><span>
</span><span id="line-359"></span><span>    </span><span id="local-6989586621681088156"><span class="annot"><span class="annottext">mk_dm_info :: forall n m.
Name
-&gt; Maybe (DefMethSpec (SrcSpan, Type))
-&gt; TcRnIf n m (Maybe (Name, DefMethSpec Type))
</span><a href="#local-6989586621681088156"><span class="hs-identifier hs-var hs-var">mk_dm_info</span></a></span></span><span> </span><span class="annot"><span class="annottext">Name
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Maybe (DefMethSpec (SrcSpan, Type))
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-360"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Name, DefMethSpec Type)
-&gt; IOEnv (Env n m) (Maybe (Name, DefMethSpec Type))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (Name, DefMethSpec Type)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-361"></span><span>    </span><span class="annot"><a href="#local-6989586621681088156"><span class="hs-identifier hs-var">mk_dm_info</span></a></span><span> </span><span id="local-6989586621681088150"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088150"><span class="hs-identifier hs-var">op_name</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="annot"><span class="annottext">DefMethSpec (SrcSpan, Type)
</span><a href="GHC.Types.Basic.html#VanillaDM"><span class="hs-identifier hs-var">VanillaDM</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-362"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681088148"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088148"><span class="hs-identifier hs-var">dm_name</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; (OccName -&gt; OccName) -&gt; TcRnIf n m Name
forall m n. Name -&gt; (OccName -&gt; OccName) -&gt; TcRnIf m n Name
</span><a href="GHC.Tc.TyCl.Build.html#newImplicitBinder"><span class="hs-identifier hs-var">newImplicitBinder</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088150"><span class="hs-identifier hs-var">op_name</span></a></span><span> </span><span class="annot"><span class="annottext">OccName -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#mkDefaultMethodOcc"><span class="hs-identifier hs-var">mkDefaultMethodOcc</span></a></span><span>
</span><span id="line-363"></span><span>           </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Maybe (Name, DefMethSpec Type)
-&gt; IOEnv (Env n m) (Maybe (Name, DefMethSpec Type))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Name, DefMethSpec Type) -&gt; Maybe (Name, DefMethSpec Type)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088148"><span class="hs-identifier hs-var">dm_name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">DefMethSpec Type
forall ty. DefMethSpec ty
</span><a href="GHC.Types.Basic.html#VanillaDM"><span class="hs-identifier hs-var">VanillaDM</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-364"></span><span>    </span><span class="annot"><a href="#local-6989586621681088156"><span class="hs-identifier hs-var">mk_dm_info</span></a></span><span> </span><span id="local-6989586621681088146"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088146"><span class="hs-identifier hs-var">op_name</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Basic.html#GenericDM"><span class="hs-identifier hs-type">GenericDM</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681088144"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681088144"><span class="hs-identifier hs-var">loc</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681088143"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088143"><span class="hs-identifier hs-var">dm_ty</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-365"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681088142"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088142"><span class="hs-identifier hs-var">dm_name</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; (OccName -&gt; OccName) -&gt; SrcSpan -&gt; TcRnIf n m Name
forall m n.
Name -&gt; (OccName -&gt; OccName) -&gt; SrcSpan -&gt; TcRnIf m n Name
</span><a href="GHC.Tc.TyCl.Build.html#newImplicitBinderLoc"><span class="hs-identifier hs-var">newImplicitBinderLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088146"><span class="hs-identifier hs-var">op_name</span></a></span><span> </span><span class="annot"><span class="annottext">OccName -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#mkDefaultMethodOcc"><span class="hs-identifier hs-var">mkDefaultMethodOcc</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681088144"><span class="hs-identifier hs-var">loc</span></a></span><span>
</span><span id="line-366"></span><span>           </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Maybe (Name, DefMethSpec Type)
-&gt; IOEnv (Env n m) (Maybe (Name, DefMethSpec Type))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Name, DefMethSpec Type) -&gt; Maybe (Name, DefMethSpec Type)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088142"><span class="hs-identifier hs-var">dm_name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type -&gt; DefMethSpec Type
forall ty. ty -&gt; DefMethSpec ty
</span><a href="GHC.Types.Basic.html#GenericDM"><span class="hs-identifier hs-var">GenericDM</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681088143"><span class="hs-identifier hs-var">dm_ty</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-367"></span><span>
</span><span id="line-368"></span><span class="hs-comment">{-
Note [Class newtypes and equality predicates]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider
        class (a ~ F b) =&gt; C a b where
          op :: a -&gt; b

We cannot represent this by a newtype, even though it's not
existential, because there are two value fields (the equality
predicate and op. See #2238

Moreover,
          class (a ~ F b) =&gt; C a b where {}
Here we can't use a newtype either, even though there is only
one field, because equality predicates are unboxed, and classes
are boxed.
-}</span><span>
</span><span id="line-385"></span><span>
</span><span id="line-386"></span><span id="local-6989586621681088604"><span id="local-6989586621681088605"><span class="annot"><a href="GHC.Tc.TyCl.Build.html#newImplicitBinder"><span class="hs-identifier hs-type">newImplicitBinder</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span>                       </span><span class="hs-comment">-- Base name</span><span>
</span><span id="line-387"></span><span>                  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#OccName"><span class="hs-identifier hs-type">OccName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#OccName"><span class="hs-identifier hs-type">OccName</span></a></span><span class="hs-special">)</span><span>       </span><span class="hs-comment">-- Occurrence name modifier</span><span>
</span><span id="line-388"></span><span>                  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRnIf"><span class="hs-identifier hs-type">TcRnIf</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681088605"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681088604"><span class="hs-identifier hs-type">n</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span></span></span><span>            </span><span class="hs-comment">-- Implicit name</span><span>
</span><span id="line-389"></span><span class="hs-comment">-- Called in GHC.Tc.TyCl.Build to allocate the implicit binders of type/class decls</span><span>
</span><span id="line-390"></span><span class="hs-comment">-- For source type/class decls, this is the first occurrence</span><span>
</span><span id="line-391"></span><span class="hs-comment">-- For iface ones, GHC.Iface.Load has already allocated a suitable name in the cache</span><span>
</span><span id="line-392"></span><span id="newImplicitBinder"><span class="annot"><span class="annottext">newImplicitBinder :: forall m n. Name -&gt; (OccName -&gt; OccName) -&gt; TcRnIf m n Name
</span><a href="GHC.Tc.TyCl.Build.html#newImplicitBinder"><span class="hs-identifier hs-var hs-var">newImplicitBinder</span></a></span></span><span> </span><span id="local-6989586621681088140"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088140"><span class="hs-identifier hs-var">base_name</span></a></span></span><span> </span><span id="local-6989586621681088139"><span class="annot"><span class="annottext">OccName -&gt; OccName
</span><a href="#local-6989586621681088139"><span class="hs-identifier hs-var">mk_sys_occ</span></a></span></span><span>
</span><span id="line-393"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; (OccName -&gt; OccName) -&gt; SrcSpan -&gt; TcRnIf m n Name
forall m n.
Name -&gt; (OccName -&gt; OccName) -&gt; SrcSpan -&gt; TcRnIf m n Name
</span><a href="GHC.Tc.TyCl.Build.html#newImplicitBinderLoc"><span class="hs-identifier hs-var">newImplicitBinderLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088140"><span class="hs-identifier hs-var">base_name</span></a></span><span> </span><span class="annot"><span class="annottext">OccName -&gt; OccName
</span><a href="#local-6989586621681088139"><span class="hs-identifier hs-var">mk_sys_occ</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; SrcSpan
</span><a href="GHC.Types.Name.html#nameSrcSpan"><span class="hs-identifier hs-var">nameSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088140"><span class="hs-identifier hs-var">base_name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-394"></span><span>
</span><span id="line-395"></span><span id="local-6989586621681088500"><span id="local-6989586621681088501"><span class="annot"><a href="GHC.Tc.TyCl.Build.html#newImplicitBinderLoc"><span class="hs-identifier hs-type">newImplicitBinderLoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span>                       </span><span class="hs-comment">-- Base name</span><span>
</span><span id="line-396"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#OccName"><span class="hs-identifier hs-type">OccName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#OccName"><span class="hs-identifier hs-type">OccName</span></a></span><span class="hs-special">)</span><span>       </span><span class="hs-comment">-- Occurrence name modifier</span><span>
</span><span id="line-397"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span>
</span><span id="line-398"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRnIf"><span class="hs-identifier hs-type">TcRnIf</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681088501"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681088500"><span class="hs-identifier hs-type">n</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span></span></span><span>            </span><span class="hs-comment">-- Implicit name</span><span>
</span><span id="line-399"></span><span class="hs-comment">-- Just the same, but lets you specify the SrcSpan</span><span>
</span><span id="line-400"></span><span id="newImplicitBinderLoc"><span class="annot"><span class="annottext">newImplicitBinderLoc :: forall m n.
Name -&gt; (OccName -&gt; OccName) -&gt; SrcSpan -&gt; TcRnIf m n Name
</span><a href="GHC.Tc.TyCl.Build.html#newImplicitBinderLoc"><span class="hs-identifier hs-var hs-var">newImplicitBinderLoc</span></a></span></span><span> </span><span id="local-6989586621681088135"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088135"><span class="hs-identifier hs-var">base_name</span></a></span></span><span> </span><span id="local-6989586621681088134"><span class="annot"><span class="annottext">OccName -&gt; OccName
</span><a href="#local-6989586621681088134"><span class="hs-identifier hs-var">mk_sys_occ</span></a></span></span><span> </span><span id="local-6989586621681088133"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681088133"><span class="hs-identifier hs-var">loc</span></a></span></span><span>
</span><span id="line-401"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681088132"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681088132"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Maybe Module
</span><a href="GHC.Types.Name.html#nameModule_maybe"><span class="hs-identifier hs-var">nameModule_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088135"><span class="hs-identifier hs-var">base_name</span></a></span><span>
</span><span id="line-402"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Module -&gt; OccName -&gt; SrcSpan -&gt; TcRnIf m n Name
forall a b. Module -&gt; OccName -&gt; SrcSpan -&gt; TcRnIf a b Name
</span><a href="GHC.Iface.Env.html#newGlobalBinder"><span class="hs-identifier hs-var">newGlobalBinder</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681088132"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681088129"><span class="hs-identifier hs-var">occ</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681088133"><span class="hs-identifier hs-var">loc</span></a></span><span>
</span><span id="line-403"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>           </span><span class="hs-comment">-- When typechecking a [d| decl bracket |],</span><span>
</span><span id="line-404"></span><span>                        </span><span class="hs-comment">-- TH generates types, classes etc with Internal names,</span><span>
</span><span id="line-405"></span><span>                        </span><span class="hs-comment">-- so we follow suit for the implicit binders</span><span>
</span><span id="line-406"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681088128"><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681088128"><span class="hs-identifier hs-var">uniq</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf m n Unique
forall gbl lcl. TcRnIf gbl lcl Unique
</span><a href="GHC.Tc.Utils.Monad.html#newUnique"><span class="hs-identifier hs-var">newUnique</span></a></span><span>
</span><span id="line-407"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcRnIf m n Name
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Unique -&gt; OccName -&gt; SrcSpan -&gt; Name
</span><a href="GHC.Types.Name.html#mkInternalName"><span class="hs-identifier hs-var">mkInternalName</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681088128"><span class="hs-identifier hs-var">uniq</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681088129"><span class="hs-identifier hs-var">occ</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681088133"><span class="hs-identifier hs-var">loc</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-408"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-409"></span><span>    </span><span id="local-6989586621681088129"><span class="annot"><span class="annottext">occ :: OccName
</span><a href="#local-6989586621681088129"><span class="hs-identifier hs-var hs-var">occ</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OccName -&gt; OccName
</span><a href="#local-6989586621681088134"><span class="hs-identifier hs-var">mk_sys_occ</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; OccName
</span><a href="GHC.Types.Name.html#nameOccName"><span class="hs-identifier hs-var">nameOccName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088135"><span class="hs-identifier hs-var">base_name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-410"></span><span>
</span><span id="line-411"></span><span class="hs-comment">-- | Make the 'TyConRepName' for this 'TyCon'</span><span>
</span><span id="line-412"></span><span id="local-6989586621681088532"><span id="local-6989586621681088533"><span class="annot"><a href="GHC.Tc.TyCl.Build.html#newTyConRepName"><span class="hs-identifier hs-type">newTyConRepName</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRnIf"><span class="hs-identifier hs-type">TcRnIf</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681088533"><span class="hs-identifier hs-type">gbl</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681088532"><span class="hs-identifier hs-type">lcl</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyConRepName"><span class="hs-identifier hs-type">TyConRepName</span></a></span></span></span><span>
</span><span id="line-413"></span><span id="newTyConRepName"><span class="annot"><span class="annottext">newTyConRepName :: forall gbl lcl. Name -&gt; TcRnIf gbl lcl Name
</span><a href="GHC.Tc.TyCl.Build.html#newTyConRepName"><span class="hs-identifier hs-var hs-var">newTyConRepName</span></a></span></span><span> </span><span id="local-6989586621681088124"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088124"><span class="hs-identifier hs-var">tc_name</span></a></span></span><span>
</span><span id="line-414"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681088123"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681088123"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Maybe Module
</span><a href="GHC.Types.Name.html#nameModule_maybe"><span class="hs-identifier hs-var">nameModule_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088124"><span class="hs-identifier hs-var">tc_name</span></a></span><span>
</span><span id="line-415"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681088122"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681088122"><span class="hs-identifier hs-var">mod</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681088121"><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681088121"><span class="hs-identifier hs-var">occ</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Module -&gt; OccName -&gt; (Module, OccName)
</span><a href="GHC.Core.TyCon.html#tyConRepModOcc"><span class="hs-identifier hs-var">tyConRepModOcc</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681088123"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; OccName
</span><a href="GHC.Types.Name.html#nameOccName"><span class="hs-identifier hs-var">nameOccName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088124"><span class="hs-identifier hs-var">tc_name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-416"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Module -&gt; OccName -&gt; SrcSpan -&gt; TcRnIf gbl lcl Name
forall a b. Module -&gt; OccName -&gt; SrcSpan -&gt; TcRnIf a b Name
</span><a href="GHC.Iface.Env.html#newGlobalBinder"><span class="hs-identifier hs-var">newGlobalBinder</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681088122"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681088121"><span class="hs-identifier hs-var">occ</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="GHC.Types.SrcLoc.html#noSrcSpan"><span class="hs-identifier hs-var">noSrcSpan</span></a></span><span>
</span><span id="line-417"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-418"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; (OccName -&gt; OccName) -&gt; TcRnIf gbl lcl Name
forall m n. Name -&gt; (OccName -&gt; OccName) -&gt; TcRnIf m n Name
</span><a href="GHC.Tc.TyCl.Build.html#newImplicitBinder"><span class="hs-identifier hs-var">newImplicitBinder</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681088124"><span class="hs-identifier hs-var">tc_name</span></a></span><span> </span><span class="annot"><span class="annottext">OccName -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#mkTyConRepOcc"><span class="hs-identifier hs-var">mkTyConRepOcc</span></a></span><span>
</span><span id="line-419"></span></pre></body></html>